gpio: vr41xx: fix up errorpath on probe()
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 8 Jul 2014 07:22:10 +0000 (09:22 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 9 Jul 2014 10:22:54 +0000 (12:22 +0200)
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>
drivers/gpio/gpio-vr41xx.c

index 66cbcc108e62f0d032b556fd4ffe2b8ac3e2aadf..dbf28fa03f6732e339f485b05002ef1b290fc6e8 100644 (file)
@@ -515,7 +515,7 @@ static int giu_probe(struct platform_device *pdev)
        struct resource *res;
        unsigned int trigger, i, pin;
        struct irq_chip *chip;
-       int irq, retval;
+       int irq, ret;
 
        switch (pdev->id) {
        case GPIO_50PINS_PULLUPDOWN:
@@ -544,7 +544,11 @@ static int giu_probe(struct platform_device *pdev)
 
        vr41xx_gpio_chip.dev = &pdev->dev;
 
-       retval = gpiochip_add(&vr41xx_gpio_chip);
+       ret = gpiochip_add(&vr41xx_gpio_chip);
+       if (!ret) {
+               iounmap(giu_base);
+               return -ENODEV;
+       }
 
        giu_write(GIUINTENL, 0);
        giu_write(GIUINTENH, 0);
This page took 0.029059 seconds and 5 git commands to generate.