History

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.

Jiasheng Jiang committed 3 years ago

Commit c1bcb971 parent 8c009141 file · +6 −2Browse files

Unified · Split

drivers/gpio/gpio-sifive.c+6−2
@@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev) · 220 unmodified lines
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,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t