* [PATCH 1/3] rtc: mpfs: switch to devm_device_init_wakeup
@ 2025-03-03 22:35 alexandre.belloni
2025-03-03 22:35 ` [PATCH 2/3] rtc: pm8xxx: fix possible race condition alexandre.belloni
2025-03-03 22:35 ` [PATCH 3/3] rtc: pm8xxx: switch to devm_device_init_wakeup alexandre.belloni
0 siblings, 2 replies; 3+ messages in thread
From: alexandre.belloni @ 2025-03-03 22:35 UTC (permalink / raw)
To: Conor Dooley, Daire McNamara, Alexandre Belloni
Cc: linux-riscv, linux-rtc, linux-kernel
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
Switch to devm_device_init_wakeup to avoid a possible memory leak as wakeup
is never disabled.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-mpfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-mpfs.c b/drivers/rtc/rtc-mpfs.c
index 5a38649cbd43..6aa3eae575d2 100644
--- a/drivers/rtc/rtc-mpfs.c
+++ b/drivers/rtc/rtc-mpfs.c
@@ -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");
--
2.48.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/3] rtc: pm8xxx: fix possible race condition
2025-03-03 22:35 [PATCH 1/3] rtc: mpfs: switch to devm_device_init_wakeup alexandre.belloni
@ 2025-03-03 22:35 ` alexandre.belloni
2025-03-03 22:35 ` [PATCH 3/3] rtc: pm8xxx: switch to devm_device_init_wakeup alexandre.belloni
1 sibling, 0 replies; 3+ messages in thread
From: alexandre.belloni @ 2025-03-03 22:35 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-arm-msm, linux-rtc, linux-kernel
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
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.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-pm8xxx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index 852d80188bd0..3b9709214a08 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -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 = {
--
2.48.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] rtc: pm8xxx: switch to devm_device_init_wakeup
2025-03-03 22:35 [PATCH 1/3] rtc: mpfs: switch to devm_device_init_wakeup alexandre.belloni
2025-03-03 22:35 ` [PATCH 2/3] rtc: pm8xxx: fix possible race condition alexandre.belloni
@ 2025-03-03 22:35 ` alexandre.belloni
1 sibling, 0 replies; 3+ messages in thread
From: alexandre.belloni @ 2025-03-03 22:35 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-arm-msm, linux-rtc, linux-kernel
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
Switch to devm_device_init_wakeup to avoid a possible memory leak as wakeup
is never disabled.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-pm8xxx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-pm8xxx.c b/drivers/rtc/rtc-pm8xxx.c
index 3b9709214a08..a88073efffb3 100644
--- a/drivers/rtc/rtc-pm8xxx.c
+++ b/drivers/rtc/rtc-pm8xxx.c
@@ -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))
--
2.48.1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-03 22:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-03 22:35 [PATCH 1/3] rtc: mpfs: switch to devm_device_init_wakeup alexandre.belloni
2025-03-03 22:35 ` [PATCH 2/3] rtc: pm8xxx: fix possible race condition alexandre.belloni
2025-03-03 22:35 ` [PATCH 3/3] rtc: pm8xxx: switch to devm_device_init_wakeup alexandre.belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®