aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2014-07-08 03:22:10 -0400
committerLinus Walleij <linus.walleij@linaro.org>2014-07-09 06:22:54 -0400
commit246a144eed4093befc58e00cf3ba55e647977420 (patch)
tree14b3a30eefd9037232b1ba4f135f32795b6d3e48
parent7cb5409b10d9f8316ca2539591acb6a5f7fd4139 (diff)
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>
-rw-r--r--drivers/gpio/gpio-vr41xx.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-vr41xx.c b/drivers/gpio/gpio-vr41xx.c
index 66cbcc108e62..dbf28fa03f67 100644
--- a/drivers/gpio/gpio-vr41xx.c
+++ b/drivers/gpio/gpio-vr41xx.c
@@ -515,7 +515,7 @@ static int giu_probe(struct platform_device *pdev)
515 struct resource *res; 515 struct resource *res;
516 unsigned int trigger, i, pin; 516 unsigned int trigger, i, pin;
517 struct irq_chip *chip; 517 struct irq_chip *chip;
518 int irq, retval; 518 int irq, ret;
519 519
520 switch (pdev->id) { 520 switch (pdev->id) {
521 case GPIO_50PINS_PULLUPDOWN: 521 case GPIO_50PINS_PULLUPDOWN:
@@ -544,7 +544,11 @@ static int giu_probe(struct platform_device *pdev)
544 544
545 vr41xx_gpio_chip.dev = &pdev->dev; 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 giu_write(GIUINTENL, 0); 553 giu_write(GIUINTENL, 0);
550 giu_write(GIUINTENH, 0); 554 giu_write(GIUINTENH, 0);