From: Geert Uytterhoeven Date: Wed, 4 May 2016 08:21:53 +0000 (+0200) Subject: pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9697643ff3edca036e8843235cd6e4d598a50e63;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error Currrently the gpio_chip.to_irq() callback returns -ENOSYS on error, which causes bad interactions with the serial_mctrl_gpio helpers. mctrl_gpio_init() returns -ENOSYS if GPIOLIB is not enabled, which is intended to be ignored by its callers. However, ignoring -ENOSYS when it was caused by a gpiod_to_irq() failure will lead to a crash later: Unable to handle kernel paging request at virtual address ffffffde ... PC is at mctrl_gpio_set+0x14/0x78 Fix this by returning zero instead, like gpiochip_to_irq() does. Signed-off-by: Geert Uytterhoeven Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c index a6681b8b17c3..97dff6a09ff0 100644 --- a/drivers/pinctrl/sh-pfc/gpio.c +++ b/drivers/pinctrl/sh-pfc/gpio.c @@ -212,7 +212,7 @@ static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset) } } - return -ENOSYS; + return 0; found: return pfc->irqs[i];