Skip to contentSkip to conversation

gpio: nomadik: Add missing IS_ERR() check

PATCH Applied Ethan Tidmore 3 participants 3 messages Feb 14 – Feb 19

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio: nomadik: Add missing IS_ERR() check

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")
---
 drivers/gpio/gpio-nomadik.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpio/gpio-nomadik.c +3 -0
index 97c5cd33279d..e22b713166d7 100644
@@ -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
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Ethan Tidmore
Quoted 6 lines · Ethan Tidmore

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")

Great catch!

Yours,
Linus Walleij