Skip to content

Commit

Permalink
gpio: sifive: add missing check for platform_get_irq
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
JiangJias authored and Bartosz Golaszewski committed Jun 13, 2023
1 parent 8c00914 commit c1bcb97
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/gpio/gpio-sifive.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev)
return -ENODEV;
}

for (i = 0; i < ngpio; i++)
chip->irq_number[i] = platform_get_irq(pdev, i);
for (i = 0; i < ngpio; i++) {
ret = platform_get_irq(pdev, i);
if (ret < 0)
return ret;
chip->irq_number[i] = ret;
}

ret = bgpio_init(&chip->gc, dev, 4,
chip->base + SIFIVE_GPIO_INPUT_VAL,
Expand Down

0 comments on commit c1bcb97

Please sign in to comment.