Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: vr41xx: fix up errorpath on probe()

The driver was not checking the return value from gpiochip_add()
properly, so add a bail-out check.

Reported-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

+6 -2
+6 -2
drivers/gpio/gpio-vr41xx.c
··· 515 515 struct resource *res; 516 516 unsigned int trigger, i, pin; 517 517 struct irq_chip *chip; 518 - int irq, retval; 518 + int irq, ret; 519 519 520 520 switch (pdev->id) { 521 521 case GPIO_50PINS_PULLUPDOWN: ··· 544 544 545 545 vr41xx_gpio_chip.dev = &pdev->dev; 546 546 547 - retval = gpiochip_add(&vr41xx_gpio_chip); 547 + ret = gpiochip_add(&vr41xx_gpio_chip); 548 + if (!ret) { 549 + iounmap(giu_base); 550 + return -ENODEV; 551 + } 548 552 549 553 giu_write(GIUINTENL, 0); 550 554 giu_write(GIUINTENH, 0);