Re: [PATCH] iio: dac: mcp4725: Update the cached DAC value only on success

From: Andy Shevchenko

Date: Sun Oct 25 2026 - 17:09:05 EST


On Sun, Oct 25, 2026 at 11:13:51PM +0900, Baek Kyu, Kim wrote:
> mcp4725_write_raw() updates dac_value even if mcp4725_set_value() rejects
> the requested value or reports an I2C transfer error. After writing 1000,
> a rejected write of 4096 returns -EINVAL without an I2C transfer, but
> out_voltage0_raw reports 4096. A later powerdown exit sends 00 00 instead
> of the 03 e8 frame for the last successful value. The EEPROM store path
> uses the same cache.
>
> Return the setter error before updating dac_value. This keeps the last
> successful software value for readback, powerdown exit and EEPROM writes.

Does it need a Fixes tag?

> Signed-off-by: Baek Kyu, Kim <pocj8ur4in@xxxxxxxxx>

--
With Best Regards,
Andy Shevchenko