linux-mips
[Top] [All Lists]

[PATCH] rb532: fix irq number check in rb532_set_type

To: ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: [PATCH] rb532: fix irq number check in rb532_set_type
From: Florian Fainelli <florian@openwrt.org>
Date: Wed, 27 May 2009 14:14:06 +0200
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:date:subject :mime-version:x-uid:x-length:to:content-type :content-transfer-encoding:content-disposition:message-id; bh=5C3ncmJgti/o7AdFTrCsrxjtNXt1vy5UIrWzqWMh9yw=; b=W6BdzMBsiSdodTBknZ69/apekMUG95eebqNPp01KwOJx9pJqLHyETqCLXG6JrEj95q x37VhWu/j3AlWXDeOyj32a+mfq10VEZofmhVz768K1XdCda3mtGJp9f8FznguongD02U irvRtvD7ti73qtbQ+o64riHkJzsMk6mhm0hnQ=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:date:subject:mime-version:x-uid:x-length:to :content-type:content-transfer-encoding:content-disposition :message-id; b=XTPF3YrVuuUTgzRYdwZahyNS4hLcuZcxD41peDAPhP2CvxA2K06C3r0bHddcBQnzYT mz95NSBsslay3nSh+ySOhcqVQ1asuWB45Wf+7bbRudIT+cM8yCZQnYKz3RnhpJABeyCz Zur8u/at9yplESczk7nTIyOIxsCmByUotkiT0=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
We only have 14 GPIO interrupt sources numbered
from 0 to 13. Therefore the check against irq_nr
in rb532_set_type is off-by-one. This fixes a mistake
introduced by commit 1b4f571632ffb0caa4170d886694f2555c0d9a4b.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/rb532/irq.c b/arch/mips/rb532/irq.c
index 8ac4372..f078820 100644
--- a/arch/mips/rb532/irq.c
+++ b/arch/mips/rb532/irq.c
@@ -175,7 +175,7 @@ static int rb532_set_type(unsigned int irq_nr, unsigned 
type)
        int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE;
        int group = irq_to_group(irq_nr);
 
-       if (group != GPIO_MAPPED_IRQ_GROUP || irq_nr >= (GROUP4_IRQ_BASE + 13))
+       if (group != GPIO_MAPPED_IRQ_GROUP || irq_nr > (GROUP4_IRQ_BASE + 13))
                return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL;
 
        switch (type) {

<Prev in Thread] Current Thread [Next in Thread>