[PATCH v3] pinctrl: nuvoton: Fix irq_of_parse_and_map() return value

Krzysztof Kozlowski krzysztof.kozlowski at linaro.org
Fri Apr 29 16:13:20 AEST 2022


The irq_of_parse_and_map() returns 0 on failure, not a negative ERRNO.

Fixes: 3b588e43ee5c ("pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski at linaro.org>

---

Changes since v2:
1. Rebase on Linus' devel branch.
   Will later conflict with: "pinctrl: npcm7xx: Switch to use
   for_each_gpiochip_node() helper"

Changes since v1:
1. Correct the return value passed further.
---
 drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
index 9557fac5d11c..44b77dd06d90 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
@@ -1879,11 +1879,10 @@ static int npcm7xx_gpio_of(struct npcm7xx_pinctrl *pctrl)
 				ioremap(res.start, resource_size(&res));
 
 			irq = irq_of_parse_and_map(np, 0);
-			if (irq < 0) {
+			if (!irq) {
 				dev_err(pctrl->dev,
 					"No IRQ for GPIO bank %u\n", id);
-				ret = irq;
-				return ret;
+				return -EINVAL;
 			}
 
 			ret = bgpio_init(&pctrl->gpio_bank[id].gc,
-- 
2.32.0



More information about the openbmc mailing list