Skip to content

Commit 252f49c

Browse files
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>
1 parent de404fc commit 252f49c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/rtc/rtc-pm8xxx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,11 +519,11 @@ static int pm8xxx_rtc_probe(struct platform_device *pdev)
519519
if (rc < 0)
520520
return rc;
521521

522-
rc = devm_rtc_register_device(rtc_dd->rtc);
522+
rc = devm_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
523523
if (rc)
524524
return rc;
525525

526-
return devm_pm_set_wake_irq(&pdev->dev, rtc_dd->alarm_irq);
526+
return devm_rtc_register_device(rtc_dd->rtc);
527527
}
528528

529529
static struct platform_driver pm8xxx_rtc_driver = {

0 commit comments

Comments
 (0)