All of lore.kernel.org
 help / color / mirror / Atom feed
From: cgel.zte@gmail.com
To: cgel.zte@gmail.com
Cc: Damien.Horsley@imgtec.com, abrestic@chromium.org,
	ezequiel.garcia@imgtec.com, govindraj.raja@imgtec.com,
	linus.walleij@linaro.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, lv.ruyi@zte.com.cn,
	Zeal Robot <zealci@zte.com.cn>
Subject: [PATCH v2] pinctrl: fix error check return value of irq_of_parse_and_map()
Date: Sun, 24 Apr 2022 03:14:30 +0000	[thread overview]
Message-ID: <20220424031430.3170759-1-lv.ruyi@zte.com.cn> (raw)
In-Reply-To: <20220422085240.2776527-1-lv.ruyi@zte.com.cn>

From: Lv Ruyi <lv.ruyi@zte.com.cn>

The irq_of_parse_and_map() function returns 0 on failure, and does not
return an negative value.

Fixes: cefc03e5995e ("pinctrl: Add Pistachio SoC pin control driver")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
v2: don't print irq, and return -EINVAL rather than 0
---
 drivers/pinctrl/pinctrl-pistachio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-pistachio.c b/drivers/pinctrl/pinctrl-pistachio.c
index 8d271c6b0ca4..5de691c630b4 100644
--- a/drivers/pinctrl/pinctrl-pistachio.c
+++ b/drivers/pinctrl/pinctrl-pistachio.c
@@ -1374,10 +1374,10 @@ static int pistachio_gpio_register(struct pistachio_pinctrl *pctl)
 		}
 
 		irq = irq_of_parse_and_map(child, 0);
-		if (irq < 0) {
-			dev_err(pctl->dev, "No IRQ for bank %u: %d\n", i, irq);
+		if (!irq) {
+			dev_err(pctl->dev, "No IRQ for bank %u\n", i);
 			of_node_put(child);
-			ret = irq;
+			ret = -EINVAL;
 			goto err;
 		}
 
-- 
2.25.1


  reply	other threads:[~2022-04-24  3:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22  8:52 [PATCH] " cgel.zte
2022-04-24  3:14 ` cgel.zte [this message]
2022-04-24 14:25   ` [PATCH v2] " Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220424031430.3170759-1-lv.ruyi@zte.com.cn \
    --to=cgel.zte@gmail.com \
    --cc=Damien.Horsley@imgtec.com \
    --cc=abrestic@chromium.org \
    --cc=ezequiel.garcia@imgtec.com \
    --cc=govindraj.raja@imgtec.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lv.ruyi@zte.com.cn \
    --cc=zealci@zte.com.cn \
    --subject='Re: [PATCH v2] pinctrl: fix error check return value of irq_of_parse_and_map()' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.