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>
This commit is contained in:
parent
7cb5409b10
commit
246a144eed
1 changed files with 6 additions and 2 deletions
|
@ -515,7 +515,7 @@ static int giu_probe(struct platform_device *pdev)
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
unsigned int trigger, i, pin;
|
unsigned int trigger, i, pin;
|
||||||
struct irq_chip *chip;
|
struct irq_chip *chip;
|
||||||
int irq, retval;
|
int irq, ret;
|
||||||
|
|
||||||
switch (pdev->id) {
|
switch (pdev->id) {
|
||||||
case GPIO_50PINS_PULLUPDOWN:
|
case GPIO_50PINS_PULLUPDOWN:
|
||||||
|
@ -544,7 +544,11 @@ static int giu_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
vr41xx_gpio_chip.dev = &pdev->dev;
|
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(GIUINTENL, 0);
|
||||||
giu_write(GIUINTENH, 0);
|
giu_write(GIUINTENH, 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue