rtc: interface: fix wakeup source leak in rtc_timer_do_work()
PATCH 1/1 rtc: interface: fix wakeup source leak in rtc_timer_do_work()
rtc_update_irq(), rtc_set_time() and the -ETIME paths of rtc_timer_enqueue() and rtc_timer_remove() call pm_stay_awake() on the RTC parent device before scheduling rtc->irqwork, and rtc_timer_do_work() balances that with pm_relax() when it is done.
Since commit e8ba8a2bc4f6 ("rtc: check if __rtc_read_time was successful in rtc_timer_do_work()"), a failed time read returns early without calling pm_relax(). A single read error then leaves the wakeup source active, reads of /sys/power/wakeup_count block and suspend cannot proceed.
Seen on an ASUS Zenbook A16 (UX3607OA), where reads of the PMIC GLINK RTC time out and the pmic_glink.rtc-glink.0 wakeup source stays active from boot. With this change the source is released after each failed read.
--- drivers/rtc/interface.c | 1 + 1 file changed, 1 insertion(+)
drivers/rtc/interface.c +1 -0
@@ -980,6 +980,7 @@ void rtc_timer_do_work(struct work_struct *work) again: err =__rtc_read_time (rtc, &tm);if (err) { +pm_relax (rtc->dev.parent);mutex_unlock (&rtc->ops_lock);return ; }
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
Signature · 1 line
2.56.0
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 11 lines
rtc_update_irq(),rtc_set_time()and the-ETIMEpaths ofrtc_timer_enqueue()andrtc_timer_remove()callpm_stay_awake()on the RTC parent device before schedulingrtc->irqwork, andrtc_timer_do_work()balances that withpm_relax()when it is done.Since commit
e8ba8a2bc4f6("rtc: check if__rtc_read_timewas successful inrtc_timer_do_work()"), a failed time read returns early without callingpm_relax(). A single read error then leaves the wakeup source active, reads of/sys/power/wakeup_countblock and suspend cannot proceed.
Quoted 8 lines
Seen on an ASUS Zenbook A16 (UX3607OA), where reads of the PMIC GLINK RTC time out and the pmic_glink.rtc-glink.0 wakeup source stays active from boot. With this change the source is released after each failed read.
Fixes e8ba8a2bc4f6 ("rtc: check if __rtc_read_time was successful in rtc_timer_do_work()")Signed-off-by Jesse Casco <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1