]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
iio: imu: st_lsm6dsx: Fix wakeup source leaks on device unbind
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 6 Apr 2025 20:01:44 +0000 (22:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:53 +0000 (11:13 +0200)
[ Upstream commit 4551383e78d59b34eea3f4ed28ad22df99e25d59 ]

Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20250406-b4-device-wakeup-leak-iio-v1-3-2d7d322a4a93@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c

index 4fdcc2acc94ed0f594116b9141ce85f7c4449a58..96c6106b95eef60b43eb41fef67889d44d5836db 100644 (file)
@@ -2719,8 +2719,11 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
        }
 
        if (device_property_read_bool(dev, "wakeup-source") ||
-           (pdata && pdata->wakeup_source))
-               device_init_wakeup(dev, true);
+           (pdata && pdata->wakeup_source)) {
+               err = devm_device_init_wakeup(dev);
+               if (err)
+                       return dev_err_probe(dev, err, "Failed to init wakeup\n");
+       }
 
        return 0;
 }