diff --git a/arch/blackfin/include/asm/gpio.h b/arch/blackfin/include/asm/gpio.h index d4a082ef75b472456f3f206b7d087ead9e2da39d..3c99ddc8df1684076751c3fd8c55cac326a7564e 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)