Skip to content

Commit 60caa8b

Browse files
jmaneyrol-invnjic23
authored andcommitted
iio: imu: inv_mpu6050: fix FIFO parsing when empty
Now that we are reading the full FIFO in the interrupt handler, it is possible to have an emply FIFO since we are still receiving 1 interrupt per data. Handle correctly this case instead of having an error causing a reset of the FIFO. Fixes: 0829edc ("iio: imu: inv_mpu6050: read the full fifo when processing data") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Link: https://lore.kernel.org/r/20240219154825.90656-1-inv.git-commit@tdk.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent e20f378 commit 60caa8b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
109109
/* compute and process only all complete datum */
110110
nb = fifo_count / bytes_per_datum;
111111
fifo_count = nb * bytes_per_datum;
112+
if (nb == 0)
113+
goto end_session;
112114
/* Each FIFO data contains all sensors, so same number for FIFO and sensor data */
113115
fifo_period = NSEC_PER_SEC / INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider);
114116
inv_sensors_timestamp_interrupt(&st->timestamp, fifo_period, nb, nb, pf->timestamp);

0 commit comments

Comments
 (0)