Re: [PATCH v2] staging: iio: addac: adt7316: check SPI write errors in probe

From: Maxwell Doose

Date: Sat May 09 2026 - 16:26:16 EST


On Sat, May 9, 2026 at 4:03 AM Hungyu Lin <dennylin0707@xxxxxxxxx> wrote:
>
> The probe function issues three SPI writes to switch the device
> from the default I2C protocol to SPI protocol, but ignores their
> return values.
>
> Switch the repeated SPI writes to a loop and return an error
> if any of them fail, as failing to switch the protocol should
> abort the probe.
>
> Signed-off-by: Hungyu Lin <dennylin0707@xxxxxxxxx>
> ---
> Changes in v2:
> - Return error instead of just warning
> - Clarify that repeated SPI writes are converted to a loop
> ---
> drivers/staging/iio/addac/adt7316-spi.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
[snip]

Hmmm...has this been tested? Normally patches like these don't get
merged unless tested since we need to know how the hardware would
respond when we hit an error case and quit sending data, and also some
of the timing changes introduced by writing, checking if its an error,
then jumping back. I've personally tried this patch before and it got
rejected so I'll link it below since the questions that you might get
asked will likely be similar.

Link: https://lore.kernel.org/linux-iio/20260426205039.125818-1-m32285159@xxxxxxxxx/

best regards,
max