Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH] iio: gyro: mpu3050: use devm_iio_trigger_register
@ 2026-05-20  2:41 lixinyu
  2026-05-20  3:19 ` Maxwell Doose
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: lixinyu @ 2026-05-20  2:41 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio, linux-kernel, Linus Walleij, stable

mpu3050_trigger_probe() allocates the DRDY trigger with
devm_iio_trigger_alloc() but registers it with plain
iio_trigger_register(). The remove callback calls free_irq()
on the trigger but never calls iio_trigger_unregister(), so on
module unload the trigger remains in the global trigger list
while its memory is freed by devm, leaving a dangling entry.

Switch to devm_iio_trigger_register() so the registration is
undone automatically in the same devm scope as the allocation.

Fixes: 3904b28efb2c ("iio: gyro: Add driver for the MPU-3050 gyroscope")
Cc: stable@vger.kernel.org
Signed-off-by: lixinyu <xinyuili@126.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 d84e04e4b431..bcfa83a46737 100644
--- a/drivers/iio/gyro/mpu3050-core.c
+++ b/drivers/iio/gyro/mpu3050-core.c
@@ -1127,7 +1127,7 @@ static int mpu3050_trigger_probe(struct iio_dev *indio_dev, int irq)
 	mpu3050->trig->ops = &mpu3050_trigger_ops;
 	iio_trigger_set_drvdata(mpu3050->trig, indio_dev);
 
-	ret = iio_trigger_register(mpu3050->trig);
+	ret = devm_iio_trigger_register(mpu3050->dev, mpu3050->trig);
 	if (ret)
 		goto err_iio_trigger;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-27 13:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20  2:41 [PATCH] iio: gyro: mpu3050: use devm_iio_trigger_register lixinyu
2026-05-20  3:19 ` Maxwell Doose
2026-05-20  3:24 ` [PATCH v2] " Li Xinyu
2026-05-20 11:17   ` Jonathan Cameron
2026-05-20 15:22 ` [PATCH v3] iio: gyro: mpu3050: fix missing iio_trigger_unregister and irq cleanup Li Xinyu
2026-05-21 11:47   ` Jonathan Cameron
2026-05-27 13:40     ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox