diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2009-03-28 21:18:45 +0800 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2009-03-28 21:18:45 +0800 |
commit | e1312bfcc25f9301f997bf1ce84355a0f1167847 (patch) | |
tree | b9c11675d8abda4a53787443426f7b2ac743c4c9 | |
parent | a66648756f97ea5150875b85a0177c33e41afc1d (diff) | |
download | linux-e1312bfcc25f9301f997bf1ce84355a0f1167847.tar.gz linux-e1312bfcc25f9301f997bf1ce84355a0f1167847.tar.bz2 linux-e1312bfcc25f9301f997bf1ce84355a0f1167847.zip |
Blackfin arch: add a check to make sure only Blackfin GPIOs may generate IRQs
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
-rw-r--r-- | arch/blackfin/include/asm/gpio.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h index d4a082ef75b4..3c99ddc8df16 100644 --- a/arch/blackfin/include/asm/gpio.h +++ b/arch/blackfin/include/asm/gpio.h @@ -303,7 +303,10 @@ static inline void gpio_set_value(unsigned gpio, int value) static inline int gpio_to_irq(unsigned gpio) { - return (gpio + GPIO_IRQ_BASE); + if (likely(gpio < MAX_BLACKFIN_GPIOS)) + return gpio + GPIO_IRQ_BASE; + + return -EINVAL; } static inline int irq_to_gpio(unsigned irq) |