summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-max732x.c
diff options
context:
space:
mode:
authorNicholas Krause <xerofoify@gmail.com>2015-08-18 09:55:44 -0400
committerLinus Walleij <linus.walleij@linaro.org>2015-08-26 13:34:55 +0200
commit78de5d5220322456f2568de23bc2e97bba3957e3 (patch)
tree4c0779ff49b16a6ba80a3dcb38f1c47d35f92073 /drivers/gpio/gpio-max732x.c
parent5d9452e7c52a106c9efdeb6c72fc73b184a6543f (diff)
downloadlinux-78de5d5220322456f2568de23bc2e97bba3957e3.tar.bz2
gpio: max732x: Fix error handling in probe()
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>
Diffstat (limited to 'drivers/gpio/gpio-max732x.c')
-rw-r--r--drivers/gpio/gpio-max732x.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-max732x.c b/drivers/gpio/gpio-max732x.c
index 7d3c90e9da71..8c5252c6c327 100644
--- a/drivers/gpio/gpio-max732x.c
+++ b/drivers/gpio/gpio-max732x.c
@@ -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)