diff mbox

[30/37] powerpc: mpc62xx_pic: fix get_irq handling of NO_IRQ

Message ID e619719d90d94f19b6e2b47c3f36e7873da5bef9.1305092637.git.miltonm@bga.com (mailing list archive)
State Accepted, archived
Commit 67347eba156d64150be73c9f5797342a66b123d9
Delegated to: Benjamin Herrenschmidt
Headers show

Commit Message

Milton Miller May 11, 2011, 5:30 a.m. UTC
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>
---
---
 arch/powerpc/platforms/52xx/mpc52xx_pic.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Grant Likely May 11, 2011, 7:08 p.m. UTC | #1
On Wed, May 11, 2011 at 7:30 AM, Milton Miller <miltonm@bga.com> wrote:
> 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>

> ---
> ---
>  arch/powerpc/platforms/52xx/mpc52xx_pic.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
> index bb61181..1a9a495 100644
> --- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
> +++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
> @@ -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);
> --
> 1.7.0.4
>
>
diff mbox

Patch

diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index bb61181..1a9a495 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -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);