aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/blackfin/include/asm/gpio.h5
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)
303 303
304static inline int gpio_to_irq(unsigned gpio) 304static inline int gpio_to_irq(unsigned gpio)
305{ 305{
306 return (gpio + GPIO_IRQ_BASE); 306 if (likely(gpio < MAX_BLACKFIN_GPIOS))
307 return gpio + GPIO_IRQ_BASE;
308
309 return -EINVAL;
307} 310}
308 311
309static inline int irq_to_gpio(unsigned irq) 312static inline int irq_to_gpio(unsigned irq)