From: Potin Lai <potin.lai.pt@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
Joel Stanley <joel@jms.id.au>,
Patrick Williams <patrick@stwcx.xyz>,
Potin Lai <potin.lai@quantatw.com>,
Potin Lai <potin.lai.pt@gmail.com>
Subject: [PATCH 1/1] leds: pca955x: fix return value checking of smbus block read
Date: Wed, 28 Sep 2022 16:47:09 +0800 [thread overview]
Message-ID: <20220928084709.1822312-1-potin.lai.pt@gmail.com> (raw)
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().
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
reply other threads:[~2022-09-28 8:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220928084709.1822312-1-potin.lai.pt@gmail.com \
--to=potin.lai.pt@gmail.com \
--cc=joel@jms.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=patrick@stwcx.xyz \
--cc=pavel@ucw.cz \
--cc=potin.lai@quantatw.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®