linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] pinctrl: microchip-sgpio: Correct the fwnode_irq_get() return value check
@ 2022-09-06 11:50 Andy Shevchenko
  2022-09-08  8:34 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2022-09-06 11:50 UTC (permalink / raw)
  To: Linus Walleij, Michael Walle, linux-arm-kernel, linux-gpio,
	linux-kernel
  Cc: Lars Povlsen, Steen Hegelund, UNGLinuxDriver, Andy Shevchenko

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

Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Michael Walle <michael@walle.cc>
---
v2: added tag (Michael), fixed typo in the Subject
 drivers/pinctrl/pinctrl-microchip-sgpio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-microchip-sgpio.c b/drivers/pinctrl/pinctrl-microchip-sgpio.c
index 6f55bf7d5e05..0771b743a940 100644
--- a/drivers/pinctrl/pinctrl-microchip-sgpio.c
+++ b/drivers/pinctrl/pinctrl-microchip-sgpio.c
@@ -864,9 +864,10 @@ static int microchip_sgpio_register_bank(struct device *dev,
 	gc->can_sleep		= !bank->is_input;
 
 	if (bank->is_input && priv->properties->flags & SGPIO_FLAGS_HAS_IRQ) {
-		int irq = fwnode_irq_get(fwnode, 0);
+		int irq;
 
-		if (irq) {
+		irq = fwnode_irq_get(fwnode, 0);
+		if (irq > 0) {
 			struct gpio_irq_chip *girq = &gc->irq;
 
 			gpio_irq_chip_set_chip(girq, &microchip_sgpio_irqchip);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 1/1] pinctrl: microchip-sgpio: Correct the fwnode_irq_get() return value check
  2022-09-06 11:50 [PATCH v2 1/1] pinctrl: microchip-sgpio: Correct the fwnode_irq_get() return value check Andy Shevchenko
@ 2022-09-08  8:34 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2022-09-08  8:34 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Michael Walle, linux-arm-kernel, linux-gpio, linux-kernel,
	Lars Povlsen, Steen Hegelund, UNGLinuxDriver

On Tue, Sep 6, 2022 at 1:50 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> fwnode_irq_get() may return all possible signed values, such as Linux
> error code. Fix the code to handle this properly.
>
> Fixes: be2dc859abd4 ("pinctrl: pinctrl-microchip-sgpio: Add irq support (for sparx5)")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Michael Walle <michael@walle.cc>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-08  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-06 11:50 [PATCH v2 1/1] pinctrl: microchip-sgpio: Correct the fwnode_irq_get() return value check Andy Shevchenko
2022-09-08  8:34 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).