iio: imu: adis16400: Check return value of spi_setup()
Subsystems (2)
PATCH 1/1 iio: imu: adis16400: Check return value of spi_setup()
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.
--- drivers/iio/imu/adis16400.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iio/imu/adis16400.c +4 -1
@@ -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)
Signature · 1 line
2.43.0
Quoted 7 lines · Salah Triki
In
adis16400_initial_setup(), the return value ofspi_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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerQuoted 11 lines · On Thu, 3 Sep 2026 16:35:35 +0300 Andy Shevchenko…
Quoted 7 lines · Salah Triki
In
adis16400_initial_setup(), the return value ofspi_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 <[email protected]>
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