]> git.karo-electronics.de Git - linux-beck.git/commitdiff
gpio: max732x: Fix error handling in probe()
authorNicholas Krause <xerofoify@gmail.com>
Tue, 18 Aug 2015 13:55:44 +0000 (09:55 -0400)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 26 Aug 2015 11:34:55 +0000 (13:34 +0200)
This fixes error handling in the function max732x_probe by checking
if the calls to the function max732x_readb fail by returning a error
code.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-max732x.c

index 7d3c90e9da71a313fcbac511097f159c80b15132..8c5252c6c327764cb6fc4ae99f321e2cdf830537 100644 (file)
@@ -685,9 +685,14 @@ static int max732x_probe(struct i2c_client *client,
 
        mutex_init(&chip->lock);
 
-       max732x_readb(chip, is_group_a(chip, 0), &chip->reg_out[0]);
-       if (nr_port > 8)
-               max732x_readb(chip, is_group_a(chip, 8), &chip->reg_out[1]);
+       ret = max732x_readb(chip, is_group_a(chip, 0), &chip->reg_out[0]);
+       if (ret)
+               goto out_failed;
+       if (nr_port > 8) {
+               ret = max732x_readb(chip, is_group_a(chip, 8), &chip->reg_out[1]);
+               if (ret)
+                       goto out_failed;
+       }
 
        ret = gpiochip_add(&chip->gpio_chip);
        if (ret)