In case 'spi_sync()' fails, we would be left with a max spi transfer which is not the one the user expects it to be. Hence, we need to re-set it also in this error path. Fixes: fff7352bf7a3c ("iio: imu: Add support for adis16475") Signed-off-by: Nuno Sa <nuno.sa@xxxxxxxxxx> --- drivers/iio/imu/adis16475.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/imu/adis16475.c b/drivers/iio/imu/adis16475.c index 51b76444db0b..9dca7e506200 100644 --- a/drivers/iio/imu/adis16475.c +++ b/drivers/iio/imu/adis16475.c @@ -1067,8 +1067,10 @@ static irqreturn_t adis16475_trigger_handler(int irq, void *p) adis->spi->max_speed_hz = ADIS16475_BURST_MAX_SPEED; ret = spi_sync(adis->spi, &adis->msg); - if (ret) + if (ret) { + adis->spi->max_speed_hz = cached_spi_speed_hz; goto check_burst32; + } adis->spi->max_speed_hz = cached_spi_speed_hz; buffer = adis->buffer; -- 2.31.1