[PATCH linux dev-5.15] leds: pca955x: Fix i2c_smbus_read_i2c_block_data return code check
Eddie James
eajames at linux.ibm.com
Fri Sep 30 05:18:48 AEST 2022
The function returns either a negative errno or the number of bytes
successfully read. So, only return for a negative return code.
Fixes: c9fb275212da ("leds: pca955x: Add HW blink support")
Signed-off-by: Eddie James <eajames at linux.ibm.com>
---
drivers/leds/leds-pca955x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index cf0a9fe20086..cba9876b1187 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -689,7 +689,7 @@ static int pca955x_probe(struct i2c_client *client)
err = i2c_smbus_read_i2c_block_data(client,
0x10 | (pca955x_num_input_regs(chip->bits) + 4), nls,
ls1);
- if (err)
+ if (err < 0)
return err;
for (i = 0; i < nls; ++i)
--
2.31.1
More information about the openbmc
mailing list