From: Jonathan Cameron <jic23@kernel.org>
To: inv.git-commit@tdk.com
Cc: lars@metafoo.de, linux-iio@vger.kernel.org,
stable@vger.kernel.org,
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Subject: Re: [PATCH v2] iio: imu: inv_mpu6050: fix FIFO parsing when empty
Date: Sat, 24 Feb 2024 16:27:23 +0000 [thread overview]
Message-ID: <20240224162723.1e41d4ed@jic23-huawei> (raw)
In-Reply-To: <20240219154825.90656-1-inv.git-commit@tdk.com>
On Mon, 19 Feb 2024 15:48:25 +0000
inv.git-commit@tdk.com wrote:
> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
>
> 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: 0829edc43e0a ("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>
Would have been nice to call out that the error comes from a zero length
read (I think!).
Anyhow, applied to the fixes-togreg branch of iio.git.
I might pull this into my queue for the next merge window as we are getting close
to the end of the cycle.
Jonathan
> ---
> V2: add missing stable tag
>
> drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> index 66d4ba088e70..d4f9b5d8d28d 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c
> @@ -109,6 +109,8 @@ irqreturn_t inv_mpu6050_read_fifo(int irq, void *p)
> /* compute and process only all complete datum */
> nb = fifo_count / bytes_per_datum;
> fifo_count = nb * bytes_per_datum;
> + if (nb == 0)
> + goto end_session;
> /* Each FIFO data contains all sensors, so same number for FIFO and sensor data */
> fifo_period = NSEC_PER_SEC / INV_MPU6050_DIVIDER_TO_FIFO_RATE(st->chip_config.divider);
> inv_sensors_timestamp_interrupt(&st->timestamp, fifo_period, nb, nb, pf->timestamp);
> --
> 2.34.1
>
prev parent reply other threads:[~2024-02-24 16:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-19 15:48 [PATCH v2] iio: imu: inv_mpu6050: fix FIFO parsing when empty inv.git-commit
2024-02-24 16:27 ` Jonathan Cameron [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240224162723.1e41d4ed@jic23-huawei \
--to=jic23@kernel.org \
--cc=inv.git-commit@tdk.com \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox