Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Geert Uytterhoeven and committed by
Linus Walleij
9697643f 1b0d5287

+1 -1
+1 -1
drivers/pinctrl/sh-pfc/gpio.c
··· 212 212 } 213 213 } 214 214 215 - return -ENOSYS; 215 + return 0; 216 216 217 217 found: 218 218 return pfc->irqs[i];