]> www.infradead.org Git - users/willy/pagecache.git/commit
gpiolib: check the return value of gpio_chip::get_direction()
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 10 Feb 2025 10:51:55 +0000 (11:51 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Mon, 17 Feb 2025 10:50:50 +0000 (11:50 +0100)
commit9d846b1aebbe488f245f1aa463802ff9c34cc078
tree6918ab75b1d9b32c849dfb0154b376de1cfd064c
parent0ad2507d5d93f39619fc42372c347d6006b64319
gpiolib: check the return value of gpio_chip::get_direction()

As per the API contract - gpio_chip::get_direction() may fail and return
a negative error number. However, we treat it as if it always returned 0
or 1. Check the return value of the callback and propagate the error
number up the stack.

Cc: stable@vger.kernel.org
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250210-gpio-sanitize-retvals-v1-1-12ea88506cb2@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
drivers/gpio/gpiolib.c