drivers/iio/imu/adis16400.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
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
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
On Thu, 3 Sep 2026 16:35:35 +0300 Andy Shevchenko <andriy.shevchenko@intel.com> wrote: > 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> > I assume in practice this never fails, so treating this as hardening rather than an urgent fix. Applied to the testing branch of iio.git Thanks, Jonathan
© 2016 - 2026 Red Hat, Inc.