]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: accel: fxls8962af: Fix wakeup source leaks on device unbind
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 6 Apr 2025 20:01:42 +0000 (22:01 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 12 Apr 2025 11:23:53 +0000 (12:23 +0100)
Device can be unbound, so driver must also release memory for the wakeup
source.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://patch.msgid.link/20250406-b4-device-wakeup-leak-iio-v1-1-2d7d322a4a93@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/fxls8962af-core.c

index 48e4282964a0698d422df49739365648e19bdef6..bf1d3923a181798a1c884ee08b62d86ab5aed26f 100644 (file)
@@ -1226,8 +1226,11 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq)
        if (ret)
                return ret;
 
-       if (device_property_read_bool(dev, "wakeup-source"))
-               device_init_wakeup(dev, true);
+       if (device_property_read_bool(dev, "wakeup-source")) {
+               ret = devm_device_init_wakeup(dev);
+               if (ret)
+                       return dev_err_probe(dev, ret, "Failed to init wakeup\n");
+       }
 
        return devm_iio_device_register(dev, indio_dev);
 }