Skip to content

Commit c1bcb97

Browse files
JiangJiasBartosz Golaszewski
authored andcommitted
gpio: sifive: add missing check for platform_get_irq
Add the missing check for platform_get_irq() and return error code if it fails. The returned error code will be dealed with in builtin_platform_driver(sifive_gpio_driver) and the driver will not be registered. Fixes: f52d6d8 ("gpio: sifive: To get gpio irq offset from device tree data") Signed-off-by: Jiasheng Jiang <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 8c00914 commit c1bcb97

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/gpio/gpio-sifive.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
221221
return -ENODEV;
222222
}
223223

224-
for (i = 0; i < ngpio; i++)
225-
chip->irq_number[i] = platform_get_irq(pdev, i);
224+
for (i = 0; i < ngpio; i++) {
225+
ret = platform_get_irq(pdev, i);
226+
if (ret < 0)
227+
return ret;
228+
chip->irq_number[i] = ret;
229+
}
226230

227231
ret = bgpio_init(&chip->gc, dev, 4,
228232
chip->base + SIFIVE_GPIO_INPUT_VAL,

0 commit comments

Comments
 (0)