[PATCH v2 4/4] iio: gyro: mpu3050: Fix out-of-sequence free_irq()

Ethan Tidmore posted 4 patches 1 month, 1 week ago
[PATCH v2 4/4] iio: gyro: mpu3050: Fix out-of-sequence free_irq()
Posted by Ethan Tidmore 1 month, 1 week ago
The function free_irq() is placed after iio_triggered_buffer_cleanup()
which breaks LIFO because the IRQ was setup after
iio_triggered_buffer_setup().

Place free_irq() in correct location.

Fixes: 3904b28efb2c7 ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
 drivers/iio/gyro/mpu3050-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
index 73dc7ea1f075..3517522e3a51 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -1271,9 +1271,9 @@ void mpu3050_common_remove(struct device *dev)
 	pm_runtime_get_sync(dev);
 	pm_runtime_put_noidle(dev);
 	pm_runtime_disable(dev);
-	iio_triggered_buffer_cleanup(indio_dev);
 	if (mpu3050->irq)
 		free_irq(mpu3050->irq, mpu3050->trig);
+	iio_triggered_buffer_cleanup(indio_dev);
 	mpu3050_power_down(mpu3050);
 }
 
-- 
2.53.0
Re: [PATCH v2 4/4] iio: gyro: mpu3050: Fix out-of-sequence free_irq()
Posted by Andy Shevchenko 1 month, 1 week ago
On Mon, Feb 23, 2026 at 08:35:11PM -0600, Ethan Tidmore wrote:
> The function free_irq() is placed after iio_triggered_buffer_cleanup()
> which breaks LIFO because the IRQ was setup after
> iio_triggered_buffer_setup().
> 
> Place free_irq() in correct location.

With this commit message it's unclear why it's not a part of the patch 1
to begin with. You need to rephrase to make sure it's all about
iio_triggered_buffer_cleanup() in the first place.

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v2 4/4] iio: gyro: mpu3050: Fix out-of-sequence free_irq()
Posted by Linus Walleij 1 month, 1 week ago
On Tue, Feb 24, 2026 at 3:35 AM Ethan Tidmore <ethantidmore06@gmail.com> wrote:

> The function free_irq() is placed after iio_triggered_buffer_cleanup()
> which breaks LIFO because the IRQ was setup after
> iio_triggered_buffer_setup().
>
> Place free_irq() in correct location.
>
> Fixes: 3904b28efb2c7 ("iio: gyro: Add driver for the MPU-3050 gyroscope")
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>

Reviewed-by: Linus Walleij <linusw@kernel.org>

Yours,
Linus Walleij