summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-09-08 12:43:23 +0300
committerLinus Walleij <linus.walleij@linaro.org>2022-09-08 16:18:58 +0300
commit88d60d7d94bfab00abef3596fbf54b460c2a45ec (patch)
tree3bbed8004be289d4bd60eef63f6ab7ae05315632
parent1a41d1e5c8e5c5850a15abf3d18f610e9310b8ef (diff)
downloadlinux-88d60d7d94bfab00abef3596fbf54b460c2a45ec.tar.xz
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") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220908094323.31965-1-andriy.shevchenko@linux.intel.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/pinctrl-pistachio.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c
index 940ed3fff63a..7ca4ecb6eb8d 100644
--- a/drivers/pinctrl/pinctrl-pistachio.c
+++ b/drivers/pinctrl/pinctrl-pistachio.c
@@ -1375,7 +1375,13 @@ 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;