Re: [PATCH] staging: iio: adt7316: Add error handling to adt7316_spi_probe()

Dan Carpenter
2026-04-27T08:18:57Z

On Sun, Apr 26, 2026 at 03:50:38PM -0500, Maxwell Doose wrote:
> Currently, the return values of the adt7316_spi_write() calls in
> adt7316_spi_probe() are unchecked. Add error handling to return early
> and pass on the error code if we receive an error from
> adt7316_spi_write().
>
> While at it, move all three adt7316_spi_write() calls inside a for loop
> to condense the logic.
>
> Signed-off-by: Maxwell Doose <m32285159@gmail.com>
> ---

A lot of the time, functions can't fail or if they do it means
you need to buy a new computer and there is nothing the
operating system can do to help you. spi_write() feels like
one of those things.

Plus we wouldn't add new checks like this unless they had been
tested.

regards,
dan carpenter