linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-02  7:27 Jiasheng Jiang
  2023-06-02 13:03 ` Andy Shevchenko
  2023-06-03 17:47 ` kernel test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Jiasheng Jiang @ 2023-06-02  7:27 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: linus.walleij, brgl, palmer, paul.walmsley, linux-gpio,
	linux-riscv, linux-kernel, Jiasheng Jiang

Add the missing check for platform_get_irq and return error code
if it fails.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
Changelog:

v1 -> v2:

1. Return "chip->irq_number[i]" instead of "-ENODEV".
---
 drivers/gpio/gpio-sifive.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c
index 98939cd4a71e..7245000fb049 100644
--- a/drivers/gpio/gpio-sifive.c
+++ b/drivers/gpio/gpio-sifive.c
@@ -221,8 +221,11 @@ static int sifive_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	for (i = 0; i < ngpio; i++)
+	for (i = 0; i < ngpio; i++) {
 		chip->irq_number[i] = platform_get_irq(pdev, i);
+		if (chip->irq_number[i] < 0)
+			return chip->irq_number[i];
+	}
 
 	ret = bgpio_init(&chip->gc, dev, 4,
 			 chip->base + SIFIVE_GPIO_INPUT_VAL,
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [PATCH v2] gpio: sifive: Add missing check for platform_get_irq
@ 2023-06-05  1:17 Jiasheng Jiang
  0 siblings, 0 replies; 5+ messages in thread
From: Jiasheng Jiang @ 2023-06-05  1:17 UTC (permalink / raw)
  To: andy.shevchenko
  Cc: oe-kbuild-all, linus.walleij, brgl, palmer, paul.walmsley,
	linux-gpio, linux-riscv, linux-kernel, Jiasheng Jiang

On Sun, 4 Jun 2023 04:59:46 +0800 Andy Shevchenko wrote:
>>    224          for (i = 0; i < ngpio; i++) {
>>    225                  chip->irq_number[i] = platform_get_irq(pdev, i);
>>  > 226                  if (chip->irq_number[i] < 0)
>>    227                          return chip->irq_number[i];
> 
> So, this should be
> 
>   ret = ...
>   if (ret < 0)
>     return ret;
>   irq_number = ret;
> 
>>    228          }

I will submit a v3 to fix it.
Also, the same goes for the other patch
"gpio: ath79: Add missing check for platform_get_irq".

Thanks,
Jiasheng


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2023-06-06 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02  7:27 [PATCH v2] gpio: sifive: Add missing check for platform_get_irq Jiasheng Jiang
2023-06-02 13:03 ` Andy Shevchenko
2023-06-03 17:47 ` kernel test robot
2023-06-03 20:59   ` Andy Shevchenko
2023-06-05  1:17 Jiasheng Jiang

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).