mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Siqi Chen <chensiqi@uniontech.com>,
	jagathjog1996@gmail.com, crofts@kernel.org,
	dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: imu: bmi323: check i2c_transfer() return value
Date: Sat, 21 Nov 2026 22:06:57 +0000	[thread overview]
Message-ID: <20261121220657.3e886340@jic23-hlaptop> (raw)
In-Reply-To: <awAVDTwKYxT7v8mL@ashevche-desk.local>

On Fri, 20 Nov 2026 11:38:21 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Fri, Nov 20, 2026 at 10:21:43AM +0800, Siqi Chen wrote:
> > i2c_transfer() returns the number of messages transferred or a negative
> > error code. The BMI323 I2C read path only checks for negative values and
> > maps all errors to -EIO.
> > 
> > If only the register-address message is transferred, the function copies
> > data from the receive buffer and reports success even though the read
> > message was not completed.
> > 
> > Require both messages to be transferred, preserve negative error codes,
> > and return -EIO for a short transfer.  
> 
> > OpenCode was used to identify the issue and draft the code and changelog.  
> 
> This line should be in the comment block, behind the '---' line.
> No need to resend (just remember for the future submissions).
This time I took this and dropped that bit whilst doing so.

Applied to the testing branch of iio.git as not high urgency.
In practice short reads only occur in very very rare circumstances.

Thanks

Jonathan



> 
> > Fixes: 8a636db3aa57 ("iio: imu: Add driver for BMI323 IMU")
> > Signed-off-by: Siqi Chen <chensiqi@uniontech.com>
> > ---
> > Changes in v2:
> > - Split the transfer error and short-transfer checks for readability.
> > - Move testing information below the separator.
> > 
> > Compile-tested with CONFIG_BMI323_I2C=m using:
> > 
> >   make O=/tmp/opencode/linux-build-bmi323 W=1 \
> >        drivers/iio/imu/bmi323/bmi323_i2c.o
> > 
> > No hardware or I2C fault-injection testing was performed.  
> 
> Code wise LGTM.
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> 


      reply	other threads:[~2026-11-21 22:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  2:21 Siqi Chen
2026-11-20  9:38 ` Andy Shevchenko
2026-11-21 22:06   ` Jonathan Cameron [this message]

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=20261121220657.3e886340@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=chensiqi@uniontech.com \
    --cc=crofts@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jagathjog1996@gmail.com \
    --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

all inboxes | Powered by JetHome®