linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joshua Crofts <crofts@kernel.org>
To: Siqi Chen <chensiqi@uniontech.com>,
	jagathjog1996@gmail.com, jic23@kernel.org
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: imu: bmi323: check i2c_transfer() return value
Date: Thu, 19 Nov 2026 10:27:25 +0100	[thread overview]
Message-ID: <d4a3e229-ddb4-4c01-99b7-672b64cb71c8@kernel.org> (raw)
In-Reply-To: <20261119070837.3844364-1-chensiqi@uniontech.com>

On 19-Nov-26 8:08, Siqi Chen wrote:
>  drivers/iio/imu/bmi323/bmi323_i2c.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/imu/bmi323/bmi323_i2c.c b/drivers/iio/imu/bmi323/bmi323_i2c.c
> index e025c88c30b4..18f05f119961 100644
> --- a/drivers/iio/imu/bmi323/bmi323_i2c.c
> +++ b/drivers/iio/imu/bmi323/bmi323_i2c.c
> @@ -40,8 +40,8 @@ static int bmi323_regmap_i2c_read(void *context, const void *reg_buf,
>  	msgs[1].flags = priv->i2c->flags | I2C_M_RD;
>  
>  	ret = i2c_transfer(priv->i2c->adapter, msgs, ARRAY_SIZE(msgs));
> -	if (ret < 0)
> -		return -EIO;
> +	if (ret != ARRAY_SIZE(msgs))
> +		return ret < 0 ? ret : -EIO;
Better to do

	if (ret < 0)
		return ret;
	if (ret != ARRAY_SIZE(msgs))
		return -EIO;

It improves readability.

-- 
Kind regards,
Joshua Crofts


  reply	other threads:[~2026-11-19  9:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  7:08 [PATCH] iio: imu: bmi323: check i2c_transfer() return value Siqi Chen
2026-11-19  9:27 ` Joshua Crofts [this message]
2026-11-19  9:30 ` Joshua Crofts

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=d4a3e229-ddb4-4c01-99b7-672b64cb71c8@kernel.org \
    --to=crofts@kernel.org \
    --cc=andy@kernel.org \
    --cc=chensiqi@uniontech.com \
    --cc=dlechner@baylibre.com \
    --cc=jagathjog1996@gmail.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.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;
as well as URLs for NNTP newsgroup(s).