]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:13:53 +0000 (11:13 +0200)
[ Upstream commit 0cd34d98dfd4f2b596415b8f12faf7b946613458 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/accel/fxls8962af-core.c

index 987212a7c038ec00cbbd0d3d96af80cf3a94e949..a0ae30c86687af550fc645d200a07e698ac26d16 100644 (file)
@@ -1229,8 +1229,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);
 }