Re: [PATCH v6 3/3] hwmon: (pmbus/max31785) check for partial i2c_transfer in read_long_data
From: Guenter Roeck
Date: Sat Mar 21 2026 - 20:48:49 EST
On Sat, Mar 21, 2026 at 06:12:05PM +0000, Pradhan, Sanman wrote:
> From: Sanman Pradhan <psanman@xxxxxxxxxxx>
>
> i2c_transfer() returns the number of messages successfully
> transferred, not only a negative errno on failure. When called with
> two messages (write command byte followed by a read of the 4-byte
> response), a return value of 1 means the command write succeeded but
> the read did not complete. In that case, rspbuf remains uninitialized
> and must not be interpreted as valid data.
>
> Treat any return value other than ARRAY_SIZE(msg) as an error, and
> return -EIO for partial completion. Also return 0 on success instead
> of the message count, since the caller only needs to distinguish
> success from failure.
>
> Signed-off-by: Sanman Pradhan <psanman@xxxxxxxxxxx>
Applied.
Thanks,
Guenter