Skip to contentSkip to conversation

pinctrl: pistachio: Correct the fwnode_irq_get() return value check

PATCH Superseded Andy Shevchenko 2 participants 2 messages Sep 8, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: pistachio: Correct the fwnode_irq_get() return value check

fwnode_irq_get() may return all possible signed values, such as Linux error code or 0. Fix the code to handle this properly.

Fixes 1074e1d23a5c ("pinctrl: pistachio: Switch to use fwnode instead of")
---
 drivers/pinctrl/pinctrl-pistachio.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/pinctrl/pinctrl-pistachio.c +6 -0
index 940ed3fff63a..7ca4ecb6eb8d 100644
@@ -1374,8 +1374,14 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
 
 		ret = fwnode_irq_get(child, 0);
 		if (ret < 0) {
+			fwnode_handle_put(child);
+			dev_err(pctl->dev, "Failed to retrieve IRQ for bank %u\n", i);
+			goto err;
+		}
+		if (!ret) {
 			fwnode_handle_put(child);
 			dev_err(pctl->dev, "No IRQ for bank %u\n", i);
+			ret = -EINVAL;
 			goto err;
 		}
 		irq = ret;
Signature · 1 line
2.35.1
#1 lore raw
Quoted 5 lines · Andy Shevchenko

fwnode_irq_get() may return all possible signed values, such as Linux error code or 0. Fix the code to handle this properly.

Fixes 1074e1d23a5c ("pinctrl: pistachio: Switch to use fwnode instead of")

Patch applied.

Yours,
Linus Walleij