diff options
author | Nicholas Krause <xerofoify@gmail.com> | 2015-08-26 17:52:19 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-10-02 04:19:34 -0700 |
commit | c75a37720480819291ebca0db7fab4e87c46f73d (patch) | |
tree | d4a838e165bc4cd3e596f66f329387af8fcdb6c8 /drivers/gpio/gpio-pca953x.c | |
parent | 49a5bd880cb63fba9f4589a89d68b8a255062a5f (diff) | |
download | linux-stable-c75a37720480819291ebca0db7fab4e87c46f73d.tar.gz linux-stable-c75a37720480819291ebca0db7fab4e87c46f73d.tar.bz2 linux-stable-c75a37720480819291ebca0db7fab4e87c46f73d.zip |
gpio: Fix error checking in the function device_pca957x_init
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>
Diffstat (limited to 'drivers/gpio/gpio-pca953x.c')
-rw-r--r-- | drivers/gpio/gpio-pca953x.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index 50caeb1ee350..4e5745d32828 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -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: |