Re: [PATCH v3] iio: dac: max5821: fix return value check in powerdown sync
From: Jonathan Cameron
Date: Tue Apr 28 2026 - 12:30:14 EST
On Tue, 28 Apr 2026 10:55:45 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> 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>
>
Applied and marked for stable.