I guess you missed v2 here. Moreover, can you please proper Fixes tag? Reply-To: In-Reply-To: <20250310132508.24660-2-s.seva@xxxxxxxxx> > Prevent st_lsm6dsx_read_fifo and st_lsm6dsx_read_tagged_fifo functions > from falling in an infinite loop in case pattern_len is equal to zero and > the device FIFO is not empty. > > Signed-off-by: Silvano Seva <s.seva@xxxxxxxxx> > --- > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > index 0a7cd8c1aa33..39a7e15ae9ae 100644 > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c > @@ -392,9 +392,14 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) > if (fifo_status & cpu_to_le16(ST_LSM6DSX_FIFO_EMPTY_MASK)) > return 0; > > + if (!pattern_len) > + pattern_len = ST_LSM6DSX_SAMPLE_SIZE; > + > fifo_len = (le16_to_cpu(fifo_status) & fifo_diff_mask) * > ST_LSM6DSX_CHAN_SIZE; > fifo_len = (fifo_len / pattern_len) * pattern_len; > + if (!fifo_len) > + return 0; this is not needed, please drop it. Regards, Lorenzo > > acc_sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_ACC]); > gyro_sensor = iio_priv(hw->iio_devs[ST_LSM6DSX_ID_GYRO]); > @@ -623,6 +628,9 @@ int st_lsm6dsx_read_tagged_fifo(struct st_lsm6dsx_hw *hw) > if (!fifo_len) > return 0; > > + if (!pattern_len) > + pattern_len = ST_LSM6DSX_TAGGED_SAMPLE_SIZE; > + > for (read_len = 0; read_len < fifo_len; read_len += pattern_len) { > err = st_lsm6dsx_read_block(hw, > ST_LSM6DSX_REG_FIFO_OUT_TAG_ADDR, > -- > 2.48.1 >
Attachment:
signature.asc
Description: PGP signature