* [PATCH] iio: imu: adis16400: Check return value of spi_setup()
@ 2026-09-03 12:27 Salah Triki
2026-09-03 13:35 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Salah Triki @ 2026-09-03 12:27 UTC (permalink / raw)
To: Nuno Sá, Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko
Cc: linux, linux-iio, linux-kernel, Salah Triki
In adis16400_initial_setup(), the return value of spi_setup() was ignored.
If SPI configuration fails, the driver would proceed with the
initialization anyway, leading to undefined behavior or silent failures
during device setup.
Check the return value of spi_setup() and return the error code immediately
if it fails.
Fixes: cd888a17f95f ("staging:iio:adis16400: Use adis library")
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
drivers/iio/imu/adis16400.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/imu/adis16400.c b/drivers/iio/imu/adis16400.c
index 4842346f9f0c..f51878066b2f 100644
--- a/drivers/iio/imu/adis16400.c
+++ b/drivers/iio/imu/adis16400.c
@@ -420,7 +420,10 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev)
else
st->adis.spi->max_speed_hz = ADIS16400_SPI_FAST;
st->adis.spi->mode = SPI_MODE_3;
- spi_setup(st->adis.spi);
+
+ ret = spi_setup(st->adis.spi);
+ if (ret)
+ return ret;
ret = __adis_initial_startup(&st->adis);
if (ret)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: imu: adis16400: Check return value of spi_setup()
2026-09-03 12:27 [PATCH] iio: imu: adis16400: Check return value of spi_setup() Salah Triki
@ 2026-09-03 13:35 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-09-03 13:35 UTC (permalink / raw)
To: Salah Triki
Cc: Nuno Sá, Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, linux, linux-iio, linux-kernel
On Thu, Sep 03, 2026 at 01:27:33PM +0100, Salah Triki wrote:
> In adis16400_initial_setup(), the return value of spi_setup() was ignored.
> If SPI configuration fails, the driver would proceed with the
> initialization anyway, leading to undefined behavior or silent failures
> during device setup.
>
> Check the return value of spi_setup() and return the error code immediately
> if it fails.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-03 13:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03 12:27 [PATCH] iio: imu: adis16400: Check return value of spi_setup() Salah Triki
2026-09-03 13:35 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox