Skip to content

Commit

Permalink
gpio: max732x: Fix error handling in probe()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nicholas Krause authored and Linus Walleij committed Aug 26, 2015
1 parent 5d9452e commit 78de5d5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/gpio/gpio-max732x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 78de5d5

Please sign in to comment.