i386/io_apic: fix compiler warning in create_irq
PATCH 1/1 i386/io_apic: fix compiler warning in create_irq
Fix warningarch/i386/kernel/io_apic.c: In function `create_irq':arch/i386/kernel/io_apic.c:2420: warning: 'vector' might be used uninitialized in this function
---
Only compile-tested.arch/x86_64/kernel/io_apic.c seems to have the same initialization already.
arch/i386/kernel/io_apic.c +1 -0
@@ -2421,6 +2421,7 @@ int create_irq(void)unsigned long flags; irq = -ENOSPC ; + vector =0 ;spin_lock_irqsave (&vector_lock, flags);for (new = (NR_IRQS -1 ); new >=0 ; new--) {if (platform_legacy_irq (new))
Ingo Molnar
NAKarch/i386/kernel/io_apic.c int create_irq(void) · line 2424
Quoted 9 lines · Stefan Richter
Fix warning
arch/i386/kernel/io_apic.c: In function `create_irq':arch/i386/kernel/io_apic.c:2420: warning: 'vector' might be used uninitialized in this functionarch/i386/kernel/io_apic.c +1
-0@@ -2421,6 +2421,7 @@ int create_irq(void)unsigned long flags; irq = -ENOSPC ; + vector =0 ;
NAK - the code is fine, and this is fixed in Jeff's gcc-warnings tree via annotation.
Ingo
Quoted 6 lines · On Mon, 30 Oct 2006 10:02:31 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 3 lines · Stefan Richter
Fix warning
arch/i386/kernel/io_apic.c: In function `create_irq':arch/i386/kernel/io_apic.c:2420: warning: 'vector' might be used uninitialized in this function
Quoted 8 lines
arch/i386/kernel/io_apic.c int create_irq(void) · line 2424
Quoted 5 lines
arch/i386/kernel/io_apic.c +1
-0@@ -2421,6 +2421,7 @@ int create_irq(void)unsigned long flags; irq = -ENOSPC ; + vector =0 ;NAK - the code is fine, and this is fixed in Jeff's gcc-warnings tree via annotation.
err, what gcc-warnings tree?
git+ssh://master.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git#gccbug just does lots of initialise-to-zero thingies, doesn't have any special annotation and doesn't fix io_apic.c.
Quoted 7 lines · Andrew Morton
Quoted 4 lines
Quoted 2 lines
irq = -ENOSPC;+ vector = 0;
NAK - the code is fine, and this is fixed in Jeff's gcc-warnings
tree
Quoted 1 line
via annotation.
Quoted 7 lines
err, what gcc-warnings tree?
git +ssh://master.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git#gccbug just does lots of initialise-to-zero thingies, doesn't have any special
annotation and doesn't fixio_apic.c.
this is an initialize-to-zero annotation for a false-positive gcc warning. If it's not in Jeff tree yet then it should be there ...
Ingo
Quoted 10 lines · On Tue, 31 Oct 2006 10:37:37 +0100 Ingo Molnar <[email protected]> wrote:
Quoted 9 lines · Andrew Morton
Quoted 4 lines
Quoted 2 lines
irq = -ENOSPC;+ vector = 0;
NAK - the code is fine, and this is fixed in Jeff's gcc-warnings
tree
Quoted 1 line
via annotation.
err, what gcc-warnings tree?
Quoted 9 lines
Quoted 5 lines
git +ssh://master.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git#gccbug just does lots of initialise-to-zero thingies, doesn't have any special
annotation and doesn't fixio_apic.c.this is an initialize-to-zero annotation for a false-positive gcc warning. If it's not in Jeff tree yet then it should be there ...
hm, I wouldn't call that "annotation".
Now, the
#define SHUT_GCC_UP(x) = x
... int foo SHUT_GCC_UP(foo); ...
(or whatever it was) trick was "annotation". A good way of doing it too, IMO.
Quoted 7 lines · Andrew Morton
Quoted 2 lines
this is an initialize-to-zero annotation for a false-positive gcc warning. If it's not in Jeff tree yet then it should be there ...
hm, I wouldn't call that "annotation".
Now, the
Quoted 8 lines
#define
SHUT_GCC_UP(x)= x... int foo SHUT_GCC_UP(foo); ...(or whatever it was) trick was "annotation". A good way of doing it too, IMO.
hm, i thought Jeff's tree was doing that ...
we definitely do not want to hide these places. They both make the code less readable (why initialize it to some value if that value is never used) and they hide the problem from the GCC folks too.
Ingo
Quoted 4 lines · Ingo Molnar
...
we definitely do not want to hide these places. They both make the code less readable (why initialize it to some value if that value is never used) and they hide the problem from the GCC folks too.
What about cases where it's technically impossible for gcc to ever see that a variable actually gets initialized?
Quoted 1 line
Ingo
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 SeedQuoted 8 lines · Adrian Bunk
Quoted 4 lines · Ingo Molnar
...
we definitely do not want to hide these places. They both make the code less readable (why initialize it to some value if that value is never used) and they hide the problem from the GCC folks too.What about cases where it's technically impossible for gcc to ever see that a variable actually gets initialized?
we should mark them as such or even initialize them outright. But these are the exception.
Ingo