Commit 246a144eed4093befc58e00cf3ba55e647977420
1 parent
7cb5409b10
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
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>
Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff
drivers/gpio/gpio-vr41xx.c
... | ... | @@ -515,7 +515,7 @@ |
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,7 +544,11 @@ |
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); |