Re: [PATCH] iio: adc: ad7816: propagate SPI error codes
From: Andy Shevchenko
Date: Sat May 09 2026 - 03:03:55 EST
On Sat, May 09, 2026 at 02:06:46AM +0000, Hungyu Lin wrote:
> The driver currently returns -EIO for SPI read/write failures,
> which hides the actual error code returned by the SPI subsystem.
>
> Return the original error code instead to allow better diagnostics
> and error handling by callers.
...
> static ssize_t ad7816_show_value(struct device *dev,
> ret = ad7816_spi_read(chip, &data);
> if (ret)
> - return -EIO;
> + return ret;
At least this is an ABI change and should have been mentioned in the commit
message and justified.
Yes, error code is an ABI and infamous case is already known when similar
change badly broke user space.
https://lkml.org/lkml/2012/12/23/75
...
> static inline ssize_t ad7816_set_oti(struct device *dev,
> ret = ad7816_spi_write(chip, data);
> if (ret)
> - return -EIO;
> + return ret;
Haven't checked this one, though.
--
With Best Regards,
Andy Shevchenko