[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230601082440.30110-1-jiasheng@iscas.ac.cn>
Date: Thu, 1 Jun 2023 16:24:40 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: linus.walleij@...aro.org, brgl@...ev.pl, palmer@...belt.com,
paul.walmsley@...ive.com
Cc: linux-gpio@...r.kernel.org, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] gpio: sifive: Add missing check for platform_get_irq
Add missing check for platform_get_irq and return error
if it fails.
Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
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..7bca9c415564 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 -ENODEV;
+ }
ret = bgpio_init(&chip->gc, dev, 4,
chip->base + SIFIVE_GPIO_INPUT_VAL,
--
2.25.1
Powered by blists - more mailing lists