Re: [PATCH v3] iio: dac: max5821: fix return value check in powerdown sync

From: Andy Shevchenko

Date: Tue Apr 28 2026 - 04:11:59 EST


On Mon, Apr 27, 2026 at 10:33:19PM +0100, Salah Triki wrote:
> The function max5821_sync_powerdown_mode() returned the result of
> i2c_master_send() directly. If a partial transfer occurred, it would
> be incorrectly treated as a success by the caller.
>
> While the caller currently handles the positive return value of 2 as
> success, this patch refactors the function to return 0 on full success
> and -EIO on short writes. This ensures robust error handling for
> incomplete transfers and improves code maintainability by using
> sizeof(outbuf).

Makes sense, FWIW,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

--
With Best Regards,
Andy Shevchenko