gpio:Fix error checking in the function device_pca957x_init
Alexandre Courbot
Reviewed-byNit: 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_initto properly check and return error code values from the calls to the functionpca953x_write_regsif 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 <[email protected]>--- drivers/gpio/gpio-pca953x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)drivers/gpio/gpio-pca953x.c +0
-1@@ -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.
Quoted 7 lines · Nicholas Krause
This fixes error checking in the function
device_pca957x_initto properly check and return error code values from the calls to the functionpca953x_write_regsif 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 <[email protected]>
Patch applied with Alexandre's review tag.
Yours,
Linus Walleij