Skip to contentSkip to conversation

clean-up: fixes "shadows global", "unused parameter" warnings

PATCH In review Riina Kikas 3 participants 3 messages Dec 6, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clean-up: fixes "shadows global", "unused parameter" warnings

This patch fixes warnings "declaration of prefetch' shadows a global declaration" (occuring on line 141) and "unused parameter addr'" (occuring on line 136)

arch/i386/mm/fault.c +3 -4
@@ -133,12 +133,12 @@
  * Sometimes AMD Athlon/Opteron CPUs report invalid exceptions on prefetch.
  * Check that here and ignore it.
  */
-static int __is_prefetch(struct pt_regs *regs, unsigned long addr)
+static int __is_prefetch(struct pt_regs *regs)
 {
 	unsigned long limit;
 	unsigned long instr = get_segment_eip (regs, &limit);
 	int scan_more = 1;
-	int prefetch = 0; +	int really_prefetch = 0;
 	int i;
 
 	for (i = 0; scan_more && i < 15; i++) { 
@@ -177,7 +177,7 @@
 				break;
 			if (__get_user(opcode, (unsigned char *) instr))
 				break;
-			prefetch = (instr_lo == 0xF) &&
+			really_prefetch = (instr_lo == 0xF) &&
 				(opcode == 0x0D || opcode == 0x18);
 			break;
 		default:
@@ -185,7 +185,7 @@
 			break;
 		}
 	}
-	return prefetch;
+	return really_prefetch;
 }
 
 static inline int is_prefetch(struct pt_regs *regs, unsigned long addr,
#1 lore raw
Quoted 9 lines · Riina Kikas

This patch fixes warnings "declaration of `prefetch' shadows a global declaration"
(occuring on line 141) and "unused parameter `addr'" (occuring on line 136)

arch/i386/mm/fault.c line 136

Quoted 5 lines
arch/i386/mm/fault.c +1 -1
@@ -133,12 +133,12 @@
  * Sometimes AMD Athlon/Opteron CPUs report invalid exceptions on prefetch.
  * Check that here and ignore it.
  */
-static int __is_prefetch(struct pt_regs *regs, unsigned long addr)
+static int __is_prefetch(struct pt_regs *regs)

If you make that change, at least also change the caller of __is_prefetch As the patch stands it will break the build of fault.c - I suspect you didn't compile test it.??

Also, addr gets passed in to is_prefetch() from several different locations before it gets passed on to __is_prefetch() - are you sure it's correct to just remove the function argument - can you prove that it does no harm? could it be that the correct fix would be to actually use it for something instead? I don't know the code enough to be able to answer that, but I think it's a good question that needs to be answered.

What kernel source is this against? it doesn't seem to apply to my 2.6.10-rc3-bk2 tree here.

Signature · 1 line
Jesper Juhl 
#2 lore raw
In reply to Riina Kikas
Quoted 9 lines · Riina Kikas

This patch fixes warnings "declaration of `prefetch' shadows a global declaration"
(occuring on line 141) and "unused parameter `addr'" (occuring on line 136)

arch/i386/mm/fault.c

Quoted 7 lines
arch/i386/mm/fault.c +1 -1
@@ -133,12 +133,12 @@
  * Sometimes AMD Athlon/Opteron CPUs report invalid exceptions on prefetch.
  * Check that here and ignore it.
  */
-static int __is_prefetch(struct pt_regs *regs, unsigned long addr)
+static int __is_prefetch(struct pt_regs *regs)
...
 static inline int is_prefetch(struct pt_regs *regs, unsigned long 

I wonder how this patch compiled for you considering that you didn't change the call to __is_prefetch in is_prefetch...

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed