]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: temperature: tmp006: use devm_iio_trigger_register
authorStepan Ionichev <sozdayvek@gmail.com>
Sun, 17 May 2026 18:26:13 +0000 (23:26 +0500)
committerJonathan Cameron <jic23@kernel.org>
Tue, 26 May 2026 18:22:57 +0000 (19:22 +0100)
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>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/temperature/tmp006.c

index d8d8c8936d177f84318a5dbfc6a5a502a92e86cd..bf62143fa7191ee07c2043a70338ee5ac304e693 100644 (file)
@@ -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;