Re: [PATCH] iio: imu: bmi323: check i2c_transfer() return value
From: Joshua Crofts
Date: Thu Nov 19 2026 - 04:30:36 EST
On 19-Nov-26 8:08, 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.
>
> 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.
Also the testing info should go under the ---, as it's compile tested only.
--
Kind regards,
Joshua Crofts