iio: temperature: tmp006: use devm_iio_trigger_register
Subsystems (2)
PATCH 1/1 iio: temperature: tmp006: use devm_iio_trigger_register
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.
--- drivers/iio/temperature/tmp006.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/temperature/tmp006.c +1 -1
@@ -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;
Signature · 1 line
2.43.0
Quoted 6 lines · On Sun, 17 May 2026 23:26:13 +0500 Stepan Ionichev <[email protected]> wrote:
tmp006_probe()allocates the DRDY trigger withdevm_iio_trigger_alloc()but registers it with plainiio_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.
Quoted 6 lines
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")Signed-off-by Stepan Ionichev <[email protected]>
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
Quoted 17 lines
--- drivers/iio/temperature/tmp006.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/temperature/tmp006.c +1
-1@@ -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;