Skip to contentSkip to conversation

gpio:Fix error checking in the function device_pca957x_init

PATCH Alexandre Courbot 2 participants 2 messages Sep 2, 2015 – Sep 25, 2015 1 message not in the archive GPIO

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Alexandre Courbot

author Reviewed-by
#1 lore raw

Nit: please don't forget a space after "gpio:" in your subject line.

Quoted 20 lines · Nicholas Krause

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.

---
 drivers/gpio/gpio-pca953x.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpio/gpio-pca953x.c +0 -1
index 50caeb1..4e5745d 100644
@@ -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);

drivers/gpio/gpio-pca953x.c static int device_pca957x_init(struct pca953x_chip *chip, u32 invert) · line 646

Quoted 10 lines
drivers/gpio/gpio-pca953x.c +6 -1
+       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;

Ok, cannot hurt.

#2 lore raw
In reply to a message not in the archive
Quoted 7 lines · Nicholas Krause

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.

Patch applied with Alexandre's review tag.

Yours,
Linus Walleij