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.
Unified · Split
| @@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev) · 220 unmodified lines | ||
| 221 | 221 | return -ENODEV; |
| 222 | 222 | } |
| 223 | 223 | |
| 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 | + } | |
| 226 | 230 | |
| 227 | 231 | ret = bgpio_init(&chip->gc, dev, 4, |
| 228 | 232 | chip->base + SIFIVE_GPIO_INPUT_VAL, |