openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/1] pinctrl: wpcm450: Correct the fwnode_irq_get() return value check
@ 2022-09-27 17:55 Andy Shevchenko
  2022-09-27 18:33 ` Jonathan Neuschäfer
  2022-10-04  7:41 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2022-09-27 17:55 UTC (permalink / raw)
  To: Linus Walleij, Jonathan Neuschäfer, openbmc, linux-gpio,
	linux-kernel
  Cc: Andy Shevchenko

fwnode_irq_get() can return zero to indicate IRQ mapping errors.
Handle this case by skipping the interrupt resource.

Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: amended commit message (Jonathan)
 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index 0dbeb91f0bf2..8193b92da403 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -1081,10 +1081,13 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
 
 		girq->num_parents = 0;
 		for (i = 0; i < WPCM450_NUM_GPIO_IRQS; i++) {
-			int irq = fwnode_irq_get(child, i);
+			int irq;
 
+			irq = fwnode_irq_get(child, i);
 			if (irq < 0)
 				break;
+			if (!irq)
+				continue;
 
 			girq->parents[i] = irq;
 			girq->num_parents++;
-- 
2.35.1


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

* Re: [PATCH v2 1/1] pinctrl: wpcm450: Correct the fwnode_irq_get() return value check
  2022-09-27 17:55 [PATCH v2 1/1] pinctrl: wpcm450: Correct the fwnode_irq_get() return value check Andy Shevchenko
@ 2022-09-27 18:33 ` Jonathan Neuschäfer
  2022-10-04  7:41 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Jonathan Neuschäfer @ 2022-09-27 18:33 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-gpio, Linus Walleij, Jonathan Neuschäfer,
	linux-kernel, openbmc

[-- Attachment #1: Type: text/plain, Size: 1223 bytes --]

On Tue, Sep 27, 2022 at 08:55:09PM +0300, Andy Shevchenko wrote:
> fwnode_irq_get() can return zero to indicate IRQ mapping errors.
> Handle this case by skipping the interrupt resource.
> 
> Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> v2: amended commit message (Jonathan)
>  drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> index 0dbeb91f0bf2..8193b92da403 100644
> --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> @@ -1081,10 +1081,13 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
>  
>  		girq->num_parents = 0;
>  		for (i = 0; i < WPCM450_NUM_GPIO_IRQS; i++) {
> -			int irq = fwnode_irq_get(child, i);
> +			int irq;
>  
> +			irq = fwnode_irq_get(child, i);
>  			if (irq < 0)
>  				break;
> +			if (!irq)
> +				continue;
>  
>  			girq->parents[i] = irq;
>  			girq->num_parents++;

Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net>

Thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH v2 1/1] pinctrl: wpcm450: Correct the fwnode_irq_get() return value check
  2022-09-27 17:55 [PATCH v2 1/1] pinctrl: wpcm450: Correct the fwnode_irq_get() return value check Andy Shevchenko
  2022-09-27 18:33 ` Jonathan Neuschäfer
@ 2022-10-04  7:41 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2022-10-04  7:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-gpio, openbmc, Jonathan Neuschäfer, linux-kernel

On Tue, Sep 27, 2022 at 7:54 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> fwnode_irq_get() can return zero to indicate IRQ mapping errors.
> Handle this case by skipping the interrupt resource.
>
> Fixes: a1d1e0e3d80a ("pinctrl: nuvoton: Add driver for WPCM450")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Patch applied!

Yours,
Linus Walleij

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

end of thread, other threads:[~2022-10-04  7:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-27 17:55 [PATCH v2 1/1] pinctrl: wpcm450: Correct the fwnode_irq_get() return value check Andy Shevchenko
2022-09-27 18:33 ` Jonathan Neuschäfer
2022-10-04  7:41 ` 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).