Re: [PATCH v7 1/7] iio: dac: ad5696: properly check i2c_transfer() return value

From: Andy Shevchenko

Date: Sun Jul 12 2026 - 02:58:34 EST


On Fri, Jul 10, 2026 at 12:20:45PM +0100, Rodrigo Alencar via B4 Relay wrote:

> Verify that the expected number of i2c messages were transferred when
> ad5686_i2c_read() is called. This issue exists since the support for I2C
> devices where first introduced.

...

> ret = i2c_transfer(i2c->adapter, msg, 2);
> - if (ret < 0)
> - return ret;

No need to touch this.

> + if (ret != 2)
> + return ret < 0 ? ret : -EIO;

Make it use standard pattern:

ret = i2c_transfer(i2c->adapter, msg, ARRAY_SIZE(msg));
if (ret < 0)
return ret;
if (ret != ARRAY_SIZE(msg))
return -EIO;

--
With Best Regards,
Andy Shevchenko