powerpc/mpc62xx_pic: Fix get_irq handling of NO_IRQ
authorMilton Miller <miltonm@bga.com>
Tue, 10 May 2011 19:30:18 +0000 (19:30 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 19 May 2011 05:31:49 +0000 (15:31 +1000)
If none of irq category bits were set mpc52xx_get_irq() would pass
NO_IRQ_IGNORE (-1) to irq_linear_revmap, which does an unsigned compare
and declares the interrupt above the linear map range.  It then punts
to irq_find_mapping, which performs a linear search of all irqs,
which will likely miss and only then return NO_IRQ.

If no status bit is set, then we should return NO_IRQ directly.
The interrupt should not be suppressed from spurious counting, in fact
that is the definition of supurious.

Signed-off-by: Milton Miller <miltonm@bga.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/52xx/mpc52xx_pic.c

index bb611819b832d52f39e0ed276153001c2c1e2111..1a9a4957057941c0338d5b886187d0e5ac2053f0 100644 (file)
@@ -486,7 +486,7 @@ void __init mpc52xx_init_irq(void)
 unsigned int mpc52xx_get_irq(void)
 {
        u32 status;
-       int irq = NO_IRQ_IGNORE;
+       int irq;
 
        status = in_be32(&intr->enc_status);
        if (status & 0x00000400) {      /* critical */
@@ -509,6 +509,8 @@ unsigned int mpc52xx_get_irq(void)
                } else {
                        irq |= (MPC52xx_IRQ_L1_PERP << MPC52xx_IRQ_L1_OFFSET);
                }
+       } else {
+               return NO_IRQ;
        }
 
        return irq_linear_revmap(mpc52xx_irqhost, irq);