]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rtc: s5m: switch to devm_device_init_wakeup
authorAndré Draszik <andre.draszik@linaro.org>
Wed, 9 Apr 2025 20:37:50 +0000 (21:37 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 23 Jun 2025 21:58:40 +0000 (23:58 +0200)
To release memory allocated by device_init_wakeup(true), drivers have
to call device_init_wakeup(false) in error paths and unbind.

Switch to the new devres managed version devm_device_init_wakeup() to
plug this memleak.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-29-d66d5f39b6bf@linaro.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-s5m.c

index 095b090ec3949e0e8074cc344105daa00b795245..f4caed953efdd23fd0132d74d5199dec9cdfd294 100644 (file)
@@ -779,7 +779,11 @@ static int s5m_rtc_probe(struct platform_device *pdev)
                        return dev_err_probe(&pdev->dev, ret,
                                             "Failed to request alarm IRQ %d\n",
                                             info->irq);
-               device_init_wakeup(&pdev->dev, true);
+
+               ret = devm_device_init_wakeup(&pdev->dev);
+               if (ret < 0)
+                       return dev_err_probe(&pdev->dev, ret,
+                                            "Failed to init wakeup\n");
        }
 
        if (of_device_is_system_power_controller(pdev->dev.parent->of_node) &&