* [PATCH] iio: temperature: tmp006: use devm_iio_trigger_register
@ 2026-05-17 18:26 Stepan Ionichev
2026-05-18 15:47 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Stepan Ionichev @ 2026-05-17 18:26 UTC (permalink / raw)
To: jic23
Cc: dlechner, nuno.sa, andy, hcazarim, gregkh, linux-iio,
linux-kernel, stable, sozdayvek
tmp006_probe() allocates the DRDY trigger with devm_iio_trigger_alloc()
but registers it with plain iio_trigger_register(). The driver has no
.remove() callback, so on module unload the trigger stays 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 in
the same devm scope as the allocation.
Fixes: 91f75ccf9f03 ("iio: temperature: tmp006: add triggered buffer support")
Cc: stable@vger.kernel.org
Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
---
drivers/iio/temperature/tmp006.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
index d8d8c8936..bf62143fa 100644
--- a/drivers/iio/temperature/tmp006.c
+++ b/drivers/iio/temperature/tmp006.c
@@ -350,7 +350,7 @@ static int tmp006_probe(struct i2c_client *client)
data->drdy_trig->ops = &tmp006_trigger_ops;
iio_trigger_set_drvdata(data->drdy_trig, indio_dev);
- ret = iio_trigger_register(data->drdy_trig);
+ ret = devm_iio_trigger_register(&client->dev, data->drdy_trig);
if (ret)
return ret;
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] iio: temperature: tmp006: use devm_iio_trigger_register
2026-05-17 18:26 [PATCH] iio: temperature: tmp006: use devm_iio_trigger_register Stepan Ionichev
@ 2026-05-18 15:47 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2026-05-18 15:47 UTC (permalink / raw)
To: Stepan Ionichev
Cc: dlechner, nuno.sa, andy, hcazarim, gregkh, linux-iio,
linux-kernel, stable
On Sun, 17 May 2026 23:26:13 +0500
Stepan Ionichev <sozdayvek@gmail.com> wrote:
> tmp006_probe() allocates the DRDY trigger with devm_iio_trigger_alloc()
> but registers it with plain iio_trigger_register(). The driver has no
> .remove() callback, so on module unload the trigger stays 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 in
> the same devm scope as the allocation.
>
> Fixes: 91f75ccf9f03 ("iio: temperature: tmp006: add triggered buffer support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
Looks 'obviously' correct enough that I'll pick it up with the very little time
it's been on list. If anyone disagrees do shout!
Applied to the fixes-togreg branch of iio.git
Thanks
Jonathan
> ---
> drivers/iio/temperature/tmp006.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c
> index d8d8c8936..bf62143fa 100644
> --- a/drivers/iio/temperature/tmp006.c
> +++ b/drivers/iio/temperature/tmp006.c
> @@ -350,7 +350,7 @@ static int tmp006_probe(struct i2c_client *client)
>
> data->drdy_trig->ops = &tmp006_trigger_ops;
> iio_trigger_set_drvdata(data->drdy_trig, indio_dev);
> - ret = iio_trigger_register(data->drdy_trig);
> + ret = devm_iio_trigger_register(&client->dev, data->drdy_trig);
> if (ret)
> return ret;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-18 15:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-17 18:26 [PATCH] iio: temperature: tmp006: use devm_iio_trigger_register Stepan Ionichev
2026-05-18 15:47 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®