Skip to content

Commit

Permalink
gpio: Fix error checking in the function device_pca957x_init
Browse files Browse the repository at this point in the history
This fixes error checking in the function device_pca957x_init
to properly check and return error code values from the calls
to the function pca953x_write_regs if they fail as to properly
signal callers when a error occurs due a failure when writing
registers for this gpio based device.

Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Nicholas Krause authored and Linus Walleij committed Oct 2, 2015
1 parent 49a5bd8 commit c75a377
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/gpio/gpio-pca953x.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,15 @@ static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
memset(val, 0xFF, NBANK(chip));
else
memset(val, 0, NBANK(chip));
pca953x_write_regs(chip, PCA957X_INVRT, val);
ret = pca953x_write_regs(chip, PCA957X_INVRT, val);
if (ret)
goto out;

/* To enable register 6, 7 to control pull up and pull down */
memset(val, 0x02, NBANK(chip));
pca953x_write_regs(chip, PCA957X_BKEN, val);
ret = pca953x_write_regs(chip, PCA957X_BKEN, val);
if (ret)
goto out;

return 0;
out:
Expand Down

0 comments on commit c75a377

Please sign in to comment.