]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pinctrl: sh-pfc: Let gpio_chip.to_irq() return zero on error
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 4 May 2016 08:21:53 +0000 (10:21 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 11 May 2016 11:28:48 +0000 (13:28 +0200)
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 <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/sh-pfc/gpio.c

index a6681b8b17c3b30c740b70d27f9e01e2666f9eb2..97dff6a09ff08115112748061640260e8440723e 100644 (file)
@@ -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];