Skip to contentSkip to conversation

rtc: mpfs: switch to devm_device_init_wakeup

PATCH New [email protected] 1 participant 3 messages Mar 3, 2025

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/3 rtc: mpfs: switch to devm_device_init_wakeup

From: Alexandre Belloni <[email protected]>

Switch to devm_device_init_wakeup to avoid a possible memory leak as wakeup is never disabled.

---
 drivers/rtc/rtc-mpfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-mpfs.c +1 -1
index 5a38649cbd43..6aa3eae575d2 100644
@@ -266,7 +266,7 @@ static int mpfs_rtc_probe(struct platform_device *pdev)
 	writel(prescaler, rtcdev->base + PRESCALER_REG);
 	dev_info(&pdev->dev, "prescaler set to: %lu\n", prescaler);
 
-	device_init_wakeup(&pdev->dev, true);
+	devm_device_init_wakeup(&pdev->dev);
 	ret = devm_pm_set_wake_irq(&pdev->dev, wakeup_irq);
 	if (ret)
 		dev_err(&pdev->dev, "failed to enable irq wake\n");
Signature · 1 line
2.48.1
author maintainer
#1 lore raw

PATCH 2/3 rtc: pm8xxx: fix possible race condition

From: Alexandre Belloni <[email protected]>

probe must not fail after devm_rtc_register_device is successful because the character device will be seen by userspace and may be opened right away. Call it last to avoid opening the race window.

---
 drivers/rtc/rtc-pm8xxx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-pm8xxx.c +2 -2
index 852d80188bd0..3b9709214a08 100644
@@ -519,11 +519,11 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 	if (rc < 0)
 		return rc;
 
-	rc = devm_rtc_register_device(rtc_dd->rtc);
+	rc = devm_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
 	if (rc)
 		return rc;
 
-	return devm_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
+	return devm_rtc_register_device(rtc_dd->rtc);
 }
 
 static struct platform_driver pm8xxx_rtc_driver = {
Signature · 1 line
2.48.1
author maintainer
#2 lore raw

PATCH 3/3 rtc: pm8xxx: switch to devm_device_init_wakeup

In reply to [email protected]

From: Alexandre Belloni <[email protected]>

Switch to devm_device_init_wakeup to avoid a possible memory leak as wakeup is never disabled.

---
 drivers/rtc/rtc-pm8xxx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pm8xxx.c +1 -1
index 3b9709214a08..a88073efffb3 100644
@@ -503,7 +503,7 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, rtc_dd);
 
-	device_init_wakeup(&pdev->dev, true);
+	devm_device_init_wakeup(&pdev->dev);
 
 	rtc_dd->rtc = devm_rtc_allocate_device(&pdev->dev);
 	if (IS_ERR(rtc_dd->rtc))
Signature · 1 line
2.48.1