Re: [PATCH v3 4/6] iio: adc: ti-ads7950: simplify check for spi_setup() failures
From: Jonathan Cameron
Date: Sat Mar 07 2026 - 06:49:10 EST
On Thu, 05 Mar 2026 11:21:55 -0800
Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx> wrote:
> spi_setup() specifies that it returns 0 on success or negative error on
> failure. Therefore we can simply check for the return code being 0 or
> not.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> ---
> drivers/iio/adc/ti-ads7950.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
> index 1515089dd759..273c35e03185 100644
> --- a/drivers/iio/adc/ti-ads7950.c
> +++ b/drivers/iio/adc/ti-ads7950.c
> @@ -527,7 +527,7 @@ static int ti_ads7950_probe(struct spi_device *spi)
> spi->bits_per_word = 16;
> spi->mode |= SPI_CS_WORD;
> ret = spi_setup(spi);
> - if (ret < 0) {
Given it doesn't really fit better in patch 6 than it does here
maybe drag the
if (ret)
return dev_err_probe();
here instead just to avoid tiny it of churn around brackets.
Not important though.
> + if (ret) {
> dev_err(&spi->dev, "Error in spi setup\n");
> return ret;
> }
>