Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sparc: fix sparse warnings in arch/sparc/prom for 32 bit build

Fix following sparse warnings:
arch/sparc/prom/bootstr_32.c:32:35: warning: Using plain integer as NULL pointer
arch/sparc/prom/memory.c:61:13: warning: symbol 'prom_meminit' was not declared. Should it be static?
arch/sparc/prom/misc_32.c:74:1: error: symbol 'prom_halt' redeclared with different type (originally declared at arch/sparc/include/asm/oplib_32.h:67) - different modifiers
arch/sparc/prom/ranges.c:16:26: warning: symbol 'promlib_obio_ranges' was not declared. Should it be static?
arch/sparc/prom/ranges.c:17:5: warning: symbol 'num_obio_ranges' was not declared. Should it be static?
arch/sparc/prom/ranges.c:39:1: warning: symbol 'prom_adjust_ranges' was not declared. Should it be static?
arch/sparc/prom/ranges.c:69:13: warning: symbol 'prom_ranges_init' was not declared. Should it be static?
arch/sparc/prom/tree_32.c:286:22: warning: Using plain integer as NULL pointer
arch/sparc/prom/tree_32.c:286:38: warning: Using plain integer as NULL pointer

None of the warnings indicated any serious issues.

We are now sparse clean for 32 bit build in arch/sparc/prom.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Sam Ravnborg and committed by
David S. Miller
5f66dd35 1f42be48

+15 -8
+5 -1
arch/sparc/include/asm/oplib_32.h
··· 64 64 /* Enter the prom, with no chance of continuation for the stand-alone 65 65 * which calls this. 66 66 */ 67 - extern void prom_halt(void) __attribute__ ((noreturn)); 67 + extern void __noreturn prom_halt(void); 68 68 69 69 /* Set the PROM 'sync' callback function to the passed function pointer. 70 70 * When the user gives the 'sync' command at the prom prompt while the ··· 113 113 extern void prom_putsegment(int context, unsigned long virt_addr, 114 114 int physical_segment); 115 115 116 + /* Initialize the memory lists based upon the prom version. */ 117 + void prom_meminit(void); 116 118 117 119 /* PROM device tree traversal functions... */ 118 120 ··· 178 176 /* Apply ranges of any prom node (and optionally parent node as well) to registers. */ 179 177 extern void prom_apply_generic_ranges(phandle node, phandle parent, 180 178 struct linux_prom_registers *sbusregs, int nregs); 179 + 180 + void prom_ranges_init(void); 181 181 182 182 /* CPU probing helpers. */ 183 183 int cpu_find_by_instance(int instance, phandle *prom_node, int *mid);
+2 -1
arch/sparc/prom/bootstr_32.c
··· 29 29 /* Start from 1 and go over fd(0,0,0)kernel */ 30 30 for(iter = 1; iter < 8; iter++) { 31 31 arg = (*(romvec->pv_v0bootargs))->argv[iter]; 32 - if(arg == 0) break; 32 + if (arg == NULL) 33 + break; 33 34 while(*arg != 0) { 34 35 /* Leave place for space and null. */ 35 36 if(cp >= barg_buf + BARG_LEN-2){
+1 -1
arch/sparc/prom/misc_32.c
··· 70 70 /* Drop into the prom, but completely terminate the program. 71 71 * No chance of continuing. 72 72 */ 73 - void 73 + void __noreturn 74 74 prom_halt(void) 75 75 { 76 76 unsigned long flags;
+3 -3
arch/sparc/prom/ranges.c
··· 13 13 #include <asm/types.h> 14 14 #include <asm/system.h> 15 15 16 - struct linux_prom_ranges promlib_obio_ranges[PROMREG_MAX]; 17 - int num_obio_ranges; 16 + static struct linux_prom_ranges promlib_obio_ranges[PROMREG_MAX]; 17 + static int num_obio_ranges; 18 18 19 19 /* Adjust register values based upon the ranges parameters. */ 20 20 static void ··· 35 35 } 36 36 } 37 37 38 - void 38 + static void 39 39 prom_adjust_ranges(struct linux_prom_ranges *ranges1, int nranges1, 40 40 struct linux_prom_ranges *ranges2, int nranges2) 41 41 {
+4 -2
arch/sparc/prom/tree_32.c
··· 282 282 unsigned long flags; 283 283 int ret; 284 284 285 - if(size == 0) return 0; 286 - if((pname == 0) || (value == 0)) return 0; 285 + if (size == 0) 286 + return 0; 287 + if ((pname == NULL) || (value == NULL)) 288 + return 0; 287 289 spin_lock_irqsave(&prom_lock, flags); 288 290 ret = prom_nodeops->no_setprop(node, pname, value, size); 289 291 restore_current();