summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2025-03-03 23:35:57 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2025-03-17 11:51:49 +0100
commit252f49cd71ba9d66089b447a18be792ea272a57e (patch)
tree0a89c5465946489b992fdfe4191ba51e18c0510a /drivers/rtc
parentde404fc19628352e507290f0a192ca1f537b4150 (diff)
rtc: pm8xxx: fix possible race condition
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. Link: https://lore.kernel.org/r/20250303223600.1135142-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-pm8xxx.c4
1 files 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 = {