[PATCH] gpio: nomadik: Add missing IS_ERR() check

Ethan Tidmore posted 1 patch 1 month, 2 weeks ago
drivers/gpio/gpio-nomadik.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] gpio: nomadik: Add missing IS_ERR() check
Posted by Ethan Tidmore 1 month, 2 weeks ago
The function gpio_device_get_desc() can return an error pointer and is
not checked for one. Add check for error pointer.

Fixes: ddeb66d2cb10f ("gpio: nomadik: don't print out global GPIO numbers in debugfs callbacks")
Cc: stable@vger.kernel.org
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
 drivers/gpio/gpio-nomadik.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c
index 97c5cd33279d..e22b713166d7 100644
--- a/drivers/gpio/gpio-nomadik.c
+++ b/drivers/gpio/gpio-nomadik.c
@@ -430,6 +430,9 @@ void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev,
 #ifdef CONFIG_PINCTRL_NOMADIK
 	if (mode == NMK_GPIO_ALT_C && pctldev) {
 		desc = gpio_device_get_desc(chip->gpiodev, offset);
+		if (IS_ERR(desc))
+			return;
+
 		mode = nmk_prcm_gpiocr_get_mode(pctldev, desc_to_gpio(desc));
 	}
 #endif
-- 
2.53.0
Re: [PATCH] gpio: nomadik: Add missing IS_ERR() check
Posted by Linus Walleij 1 month, 1 week ago
On Sat, Feb 14, 2026 at 5:45 AM Ethan Tidmore <ethantidmore06@gmail.com> wrote:

> The function gpio_device_get_desc() can return an error pointer and is
> not checked for one. Add check for error pointer.
>
> Fixes: ddeb66d2cb10f ("gpio: nomadik: don't print out global GPIO numbers in debugfs callbacks")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>

Great catch!
Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij
Re: [PATCH] gpio: nomadik: Add missing IS_ERR() check
Posted by Bartosz Golaszewski 1 month, 2 weeks ago
On Fri, 13 Feb 2026 22:45:31 -0600, Ethan Tidmore wrote:
> The function gpio_device_get_desc() can return an error pointer and is
> not checked for one. Add check for error pointer.
> 
> 

Applied, thanks!

[1/1] gpio: nomadik: Add missing IS_ERR() check
      https://git.kernel.org/brgl/c/58433885ee99e8c96757e82ccf6d50646c4dfe09

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>