diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2008-05-21 02:24:31 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-05-23 02:15:37 -0400 |
commit | 06a901c5621f85e07e00ac4816c7ca95620ee74a (patch) | |
tree | 0f6a0d19d889e4209a41889ed868bc8af2a581eb /include/asm-powerpc/mpic.h | |
parent | d1e8d50d5a4bc7e40b119bf513804188ce2933d0 (diff) |
[POWERPC] mpic: Fix use of uninitialized variable
Compiling ppc64_defconfig with gcc 4.3 gives thes warnings:
arch/powerpc/sysdev/mpic.c: In function 'mpic_irq_get_priority':
arch/powerpc/sysdev/mpic.c:1351: warning: 'is_ipi' may be used uninitialized in this function
arch/powerpc/sysdev/mpic.c: In function 'mpic_irq_set_priority':
arch/powerpc/sysdev/mpic.c:1328: warning: 'is_ipi' may be used uninitialized in this function
It turns out that in the cases where is_ipi is uninitialized, another
variable (mpic) will be NULL and it is dereferenced. Protect against
this by returning if mpic is NULL in mpic_irq_set_priority, and removing
mpic_irq_get_priority completely as it has no in tree callers.
This has the nice side effect of making the warning go away.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/mpic.h')
-rw-r--r-- | include/asm-powerpc/mpic.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h index 943c5a3fac8a..a4d0f876b427 100644 --- a/include/asm-powerpc/mpic.h +++ b/include/asm-powerpc/mpic.h | |||
@@ -428,12 +428,11 @@ extern void mpic_init(struct mpic *mpic); | |||
428 | */ | 428 | */ |
429 | 429 | ||
430 | 430 | ||
431 | /* Change/Read the priority of an interrupt. Default is 8 for irqs and | 431 | /* Change the priority of an interrupt. Default is 8 for irqs and |
432 | * 10 for IPIs. You can call this on both IPIs and IRQ numbers, but the | 432 | * 10 for IPIs. You can call this on both IPIs and IRQ numbers, but the |
433 | * IPI number is then the offset'ed (linux irq number mapped to the IPI) | 433 | * IPI number is then the offset'ed (linux irq number mapped to the IPI) |
434 | */ | 434 | */ |
435 | extern void mpic_irq_set_priority(unsigned int irq, unsigned int pri); | 435 | extern void mpic_irq_set_priority(unsigned int irq, unsigned int pri); |
436 | extern unsigned int mpic_irq_get_priority(unsigned int irq); | ||
437 | 436 | ||
438 | /* Setup a non-boot CPU */ | 437 | /* Setup a non-boot CPU */ |
439 | extern void mpic_setup_this_cpu(void); | 438 | extern void mpic_setup_this_cpu(void); |