* [PATCH] rtc: omap: abort probe if runtime resume fails
@ 2026-11-29 19:25 Jiawen Liu
2026-11-29 19:31 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Liu @ 2026-11-29 19:25 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc
On AM335x, the ti-sysc parent can runtime suspend before a later RTC
probe. If its functional clock fails to become ready during resume,
the RTC's synchronous runtime PM acquisition can fail. Probe ignores
that result and immediately writes the KICK and interrupt registers
while the parent remains suspended.
Use pm_runtime_resume_and_get() and return its error before accessing
any RTC registers. The helper balances the usage count on failure,
so disable runtime PM and release the optional oscillator clock in
the early error path. Check clk_prepare_enable() so that this path
only releases a clock that was successfully enabled. A successful
probe retains its runtime PM reference for the existing cleanup.
Source review traced probe and
removal. The rtc-omap object built for ARM OMAP2+ with AM33xx and
CONFIG_PM=y and for x86_64 COMPILE_TEST with CONFIG_PM=n. Both
git diff --check and checkpatch.pl passed. Runtime and hardware
reproduction were not performed.
Fixes: fc9bd9022e8d ("rtc: omap: add runtime pm support")
Signed-off-by: Jiawen Liu <liu1298662399@gmail.com>
---
drivers/rtc/rtc-omap.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 3c978edd6c2cb..acc9bb787b150 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -757,8 +757,11 @@ static int omap_rtc_probe(struct platform_device *pdev)
else
rtc->clk = devm_clk_get(&pdev->dev, "int-clk");
- if (!IS_ERR(rtc->clk))
- clk_prepare_enable(rtc->clk);
+ if (!IS_ERR(rtc->clk)) {
+ ret = clk_prepare_enable(rtc->clk);
+ if (ret)
+ return ret;
+ }
rtc->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rtc->base)) {
@@ -770,7 +773,13 @@ static int omap_rtc_probe(struct platform_device *pdev)
/* Enable the clock/module so that we can access the registers */
pm_runtime_enable(&pdev->dev);
- pm_runtime_get_sync(&pdev->dev);
+ ret = pm_runtime_resume_and_get(&pdev->dev);
+ if (ret < 0) {
+ pm_runtime_disable(&pdev->dev);
+ if (!IS_ERR(rtc->clk))
+ clk_disable_unprepare(rtc->clk);
+ return ret;
+ }
rtc->type->unlock(rtc);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rtc: omap: abort probe if runtime resume fails
2026-11-29 19:25 [PATCH] rtc: omap: abort probe if runtime resume fails Jiawen Liu
@ 2026-11-29 19:31 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-29 19:31 UTC (permalink / raw)
To: Jiawen Liu; +Cc: linux-rtc, Alexandre Belloni
> On AM335x, the ti-sysc parent can runtime suspend before a later RTC
> probe. If its functional clock fails to become ready during resume,
> the RTC's synchronous runtime PM acquisition can fail. Probe ignores
> that result and immediately writes the KICK and interrupt registers
> while the parent remains suspended.
>
> Use pm_runtime_resume_and_get() and return its error before accessing
> any RTC registers. The helper balances the usage count on failure,
> so disable runtime PM and release the optional oscillator clock in
> the early error path. Check clk_prepare_enable() so that this path
> only releases a clock that was successfully enabled. A successful
> probe retains its runtime PM reference for the existing cleanup.
>
> Source review traced probe and
> removal. The rtc-omap object built for ARM OMAP2+ with AM33xx and
> CONFIG_PM=y and for x86_64 COMPILE_TEST with CONFIG_PM=n. Both
> git diff --check and checkpatch.pl passed. Runtime and hardware
> reproduction were not performed.
>
> Fixes: fc9bd9022e8d ("rtc: omap: add runtime pm support")
> Signed-off-by: Jiawen Liu <liu1298662399@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/179598033474.2.16434657830284928463.pattern-ext-052.2@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-29 19:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 19:25 [PATCH] rtc: omap: abort probe if runtime resume fails Jiawen Liu
2026-11-29 19:31 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox