From fb76a5e579b8073b55bd65a3959673d5da9db7da Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 16 Feb 2008 16:15:57 +0000 Subject: [PATCH] Fix range check git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@696 42af7a65-404d-4744-a932-0658087f49c3 --- arch/z80/src/z8/z8_irq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/z80/src/z8/z8_irq.c b/arch/z80/src/z8/z8_irq.c index 5f7396481b..5b1d0cccea 100644 --- a/arch/z80/src/z8/z8_irq.c +++ b/arch/z80/src/z8/z8_irq.c @@ -161,11 +161,11 @@ void up_disable_irq(int irq) * register is assumed to be zero, resulting interrupt disabled. */ - if (irq < Z8_IRQ0_MAX) + if (irq <= Z8_IRQ0_MAX) { putreg8((getreg8(IRQ0ENH) & ~Z8_IRQ0_BIT(irq)), IRQ0ENH); } - else if (irq < Z8_IRQ1_MAX) + else if (irq <= Z8_IRQ1_MAX) { putreg8((getreg8(IRQ1ENH) & ~Z8_IRQ1_BIT(irq)), IRQ1ENH); } @@ -196,11 +196,11 @@ void up_enable_irq(int irq) * priority. */ - if (irq < Z8_IRQ0_MAX) + if (irq <= Z8_IRQ0_MAX) { putreg8((getreg8(IRQ0ENH) | Z8_IRQ0_BIT(irq)), IRQ0ENH); } - else if (irq < Z8_IRQ1_MAX) + else if (irq <= Z8_IRQ1_MAX) { putreg8((getreg8(IRQ1ENH) | Z8_IRQ1_BIT(irq)), IRQ1ENH); } @@ -230,12 +230,12 @@ void up_maskack_irq(int irq) * corresponding bit in the IRQ status register. */ - if (irq < Z8_IRQ0_MAX) + if (irq <= Z8_IRQ0_MAX) { putreg8((getreg8(IRQ0ENH) & ~Z8_IRQ0_BIT(irq)), IRQ0ENH); putreg8(Z8_IRQ0_BIT(irq), IRQ0); } - else if (irq < Z8_IRQ1_MAX) + else if (irq <= Z8_IRQ1_MAX) { putreg8((getreg8(IRQ1ENH) & ~Z8_IRQ1_BIT(irq)), IRQ1ENH); putreg8(Z8_IRQ1_BIT(irq), IRQ2);