openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux dev-5.15 1/1] leds: pca955x: fix return value checking of smbus block read
@ 2022-09-28  8:57 Potin Lai
  2022-09-29 20:40 ` Eddie James
  0 siblings, 1 reply; 2+ messages in thread
From: Potin Lai @ 2022-09-28  8:57 UTC (permalink / raw)
  To: openbmc, joel; +Cc: Potin Lai

In i2c_smbus_read_i2c_block_data(), it returns negtive value for error
code, otherwise returns data length of reading.
Change the if statement to "if (err < 0)" to indicate the real error
returned by i2c_smbus_read_i2c_block_data().

LORE Link: https://lore.kernel.org/all/20220928084709.1822312-1-potin.lai.pt@gmail.com/

Signed-off-by: Potin Lai <potin.lai.pt@gmail.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 cf0a9fe20086a..cba9876b11872 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH linux dev-5.15 1/1] leds: pca955x: fix return value checking of smbus block read
  2022-09-28  8:57 [PATCH linux dev-5.15 1/1] leds: pca955x: fix return value checking of smbus block read Potin Lai
@ 2022-09-29 20:40 ` Eddie James
  0 siblings, 0 replies; 2+ messages in thread
From: Eddie James @ 2022-09-29 20:40 UTC (permalink / raw)
  To: Potin Lai, openbmc, joel


On 9/28/22 03:57, Potin Lai wrote:
> In i2c_smbus_read_i2c_block_data(), it returns negtive value for error
> code, otherwise returns data length of reading.
> Change the if statement to "if (err < 0)" to indicate the real error
> returned by i2c_smbus_read_i2c_block_data().


Thanks! My mistake here.

Reviewed-by: Eddie James <eajames@linux.ibm.com>

Tested-by: Eddie James <eajames@linux.ibm.com>


>
> LORE Link: https://lore.kernel.org/all/20220928084709.1822312-1-potin.lai.pt@gmail.com/
>
> Signed-off-by: Potin Lai <potin.lai.pt@gmail.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 cf0a9fe20086a..cba9876b11872 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-29 20:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28  8:57 [PATCH linux dev-5.15 1/1] leds: pca955x: fix return value checking of smbus block read Potin Lai
2022-09-29 20:40 ` Eddie James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).