Commit 4a3a255289e7e322b8044286cce85031990f888a
Committed by
Grant Likely
1 parent
301a3da358
Exists in
master
and in
7 other branches
sparc: explicitly cast negative phandle checks to s32
When we switched sparc from using 'int's to 'phandle's (which is a u32), we neglected to do anything with the various checks for -1. For those tests, explicitly cast the phandles to s32. Signed-off-by: Andres Salomon <dilinger@queued.net> Acked-by: David S. Miller <davem@davemloft.net> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Showing 7 changed files with 25 additions and 24 deletions Side-by-side Diff
arch/sparc/kernel/auxio_32.c
... | ... | @@ -121,7 +121,7 @@ |
121 | 121 | node = prom_searchsiblings(node, "obio"); |
122 | 122 | node = prom_getchild(node); |
123 | 123 | node = prom_searchsiblings(node, "power"); |
124 | - if (node == 0 || node == -1) | |
124 | + if (node == 0 || (s32)node == -1) | |
125 | 125 | return; |
126 | 126 | |
127 | 127 | /* Map the power control register. */ |
arch/sparc/kernel/starfire.c
arch/sparc/prom/init_32.c
... | ... | @@ -60,7 +60,7 @@ |
60 | 60 | prom_nodeops = romvec->pv_nodeops; |
61 | 61 | |
62 | 62 | prom_root_node = prom_getsibling(0); |
63 | - if((prom_root_node == 0) || (prom_root_node == -1)) | |
63 | + if ((prom_root_node == 0) || ((s32)prom_root_node == -1)) | |
64 | 64 | prom_halt(); |
65 | 65 | |
66 | 66 | if((((unsigned long) prom_nodeops) == 0) || |
arch/sparc/prom/init_64.c
... | ... | @@ -35,14 +35,14 @@ |
35 | 35 | prom_cif_init(cif_handler, cif_stack); |
36 | 36 | |
37 | 37 | prom_chosen_node = prom_finddevice(prom_chosen_path); |
38 | - if (!prom_chosen_node || prom_chosen_node == -1) | |
38 | + if (!prom_chosen_node || (s32)prom_chosen_node == -1) | |
39 | 39 | prom_halt(); |
40 | 40 | |
41 | 41 | prom_stdin = prom_getint(prom_chosen_node, "stdin"); |
42 | 42 | prom_stdout = prom_getint(prom_chosen_node, "stdout"); |
43 | 43 | |
44 | 44 | node = prom_finddevice("/openprom"); |
45 | - if (!node || node == -1) | |
45 | + if (!node || (s32)node == -1) | |
46 | 46 | prom_halt(); |
47 | 47 | |
48 | 48 | prom_getstring(node, "version", prom_version, sizeof(prom_version)); |
arch/sparc/prom/tree_32.c
... | ... | @@ -40,11 +40,11 @@ |
40 | 40 | { |
41 | 41 | phandle cnode; |
42 | 42 | |
43 | - if (node == -1) | |
43 | + if ((s32)node == -1) | |
44 | 44 | return 0; |
45 | 45 | |
46 | 46 | cnode = __prom_getchild(node); |
47 | - if (cnode == 0 || cnode == -1) | |
47 | + if (cnode == 0 || (s32)cnode == -1) | |
48 | 48 | return 0; |
49 | 49 | |
50 | 50 | return cnode; |
51 | 51 | |
... | ... | @@ -72,11 +72,11 @@ |
72 | 72 | { |
73 | 73 | phandle sibnode; |
74 | 74 | |
75 | - if (node == -1) | |
75 | + if ((s32)node == -1) | |
76 | 76 | return 0; |
77 | 77 | |
78 | 78 | sibnode = __prom_getsibling(node); |
79 | - if (sibnode == 0 || sibnode == -1) | |
79 | + if (sibnode == 0 || (s32)sibnode == -1) | |
80 | 80 | return 0; |
81 | 81 | |
82 | 82 | return sibnode; |
... | ... | @@ -231,7 +231,7 @@ |
231 | 231 | /* buffer is unused argument, but as v9 uses it, we need to have the same interface */ |
232 | 232 | char *prom_firstprop(phandle node, char *bufer) |
233 | 233 | { |
234 | - if (node == 0 || node == -1) | |
234 | + if (node == 0 || (s32)node == -1) | |
235 | 235 | return ""; |
236 | 236 | |
237 | 237 | return __prom_nextprop(node, ""); |
... | ... | @@ -244,7 +244,7 @@ |
244 | 244 | */ |
245 | 245 | char *prom_nextprop(phandle node, char *oprop, char *buffer) |
246 | 246 | { |
247 | - if (node == 0 || node == -1) | |
247 | + if (node == 0 || (s32)node == -1) | |
248 | 248 | return ""; |
249 | 249 | |
250 | 250 | return __prom_nextprop(node, oprop); |
... | ... | @@ -278,7 +278,7 @@ |
278 | 278 | if (d != s + 3 && (!*d || *d == '/') |
279 | 279 | && d <= s + 3 + 8) { |
280 | 280 | node2 = node; |
281 | - while (node2 && node2 != -1) { | |
281 | + while (node2 && (s32)node2 != -1) { | |
282 | 282 | if (prom_getproperty (node2, "reg", (char *)reg, sizeof (reg)) > 0) { |
283 | 283 | if (which_io == reg[0].which_io && phys_addr == reg[0].phys_addr) { |
284 | 284 | node = node2; |
... | ... | @@ -286,7 +286,7 @@ |
286 | 286 | } |
287 | 287 | } |
288 | 288 | node2 = prom_getsibling(node2); |
289 | - if (!node2 || node2 == -1) | |
289 | + if (!node2 || (s32)node2 == -1) | |
290 | 290 | break; |
291 | 291 | node2 = prom_searchsiblings(prom_getsibling(node2), nbuf); |
292 | 292 | } |
... | ... | @@ -339,7 +339,8 @@ |
339 | 339 | node = (*romvec->pv_v2devops.v2_inst2pkg)(inst); |
340 | 340 | restore_current(); |
341 | 341 | spin_unlock_irqrestore(&prom_lock, flags); |
342 | - if (node == -1) return 0; | |
342 | + if ((s32)node == -1) | |
343 | + return 0; | |
343 | 344 | return node; |
344 | 345 | } |
arch/sparc/prom/tree_64.c
... | ... | @@ -43,10 +43,10 @@ |
43 | 43 | { |
44 | 44 | phandle cnode; |
45 | 45 | |
46 | - if (node == -1) | |
46 | + if ((s32)node == -1) | |
47 | 47 | return 0; |
48 | 48 | cnode = __prom_getchild(node); |
49 | - if (cnode == -1) | |
49 | + if ((s32)cnode == -1) | |
50 | 50 | return 0; |
51 | 51 | return cnode; |
52 | 52 | } |
53 | 53 | |
... | ... | @@ -56,10 +56,10 @@ |
56 | 56 | { |
57 | 57 | phandle cnode; |
58 | 58 | |
59 | - if (node == -1) | |
59 | + if ((s32)node == -1) | |
60 | 60 | return 0; |
61 | 61 | cnode = prom_node_to_node("parent", node); |
62 | - if (cnode == -1) | |
62 | + if ((s32)cnode == -1) | |
63 | 63 | return 0; |
64 | 64 | return cnode; |
65 | 65 | } |
66 | 66 | |
... | ... | @@ -76,10 +76,10 @@ |
76 | 76 | { |
77 | 77 | phandle sibnode; |
78 | 78 | |
79 | - if (node == -1) | |
79 | + if ((s32)node == -1) | |
80 | 80 | return 0; |
81 | 81 | sibnode = __prom_getsibling(node); |
82 | - if (sibnode == -1) | |
82 | + if ((s32)sibnode == -1) | |
83 | 83 | return 0; |
84 | 84 | |
85 | 85 | return sibnode; |
... | ... | @@ -240,7 +240,7 @@ |
240 | 240 | unsigned long args[7]; |
241 | 241 | |
242 | 242 | *buffer = 0; |
243 | - if (node == -1) | |
243 | + if ((s32)node == -1) | |
244 | 244 | return buffer; |
245 | 245 | |
246 | 246 | args[0] = (unsigned long) prom_nextprop_name; |
... | ... | @@ -266,7 +266,7 @@ |
266 | 266 | unsigned long args[7]; |
267 | 267 | char buf[32]; |
268 | 268 | |
269 | - if (node == -1) { | |
269 | + if ((s32)node == -1) { | |
270 | 270 | *buffer = 0; |
271 | 271 | return buffer; |
272 | 272 | } |
... | ... | @@ -369,7 +369,7 @@ |
369 | 369 | p1275_cmd_direct(args); |
370 | 370 | |
371 | 371 | node = (int) args[4]; |
372 | - if (node == -1) | |
372 | + if ((s32)node == -1) | |
373 | 373 | return 0; |
374 | 374 | return node; |
375 | 375 | } |
drivers/sbus/char/jsflash.c
... | ... | @@ -467,7 +467,7 @@ |
467 | 467 | |
468 | 468 | node = prom_getchild(prom_root_node); |
469 | 469 | node = prom_searchsiblings(node, "flash-memory"); |
470 | - if (node != 0 && node != -1) { | |
470 | + if (node != 0 && (s32)node != -1) { | |
471 | 471 | if (prom_getproperty(node, "reg", |
472 | 472 | (char *)®0, sizeof(reg0)) == -1) { |
473 | 473 | printk("jsflash: no \"reg\" property\n"); |