• Stephen Rothwell's avatar
    [POWERPC] mpic: Fix use of uninitialized variable · 06a901c5
    Stephen Rothwell authored
    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: default avatarStephen Rothwell <sfr@canb.auug.org.au>
    Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    06a901c5
mpic.c 40.8 KB