Skip to contentSkip to conversation

thermal: rcar: handle runtime resume failures during probe

PATCH In review Jiawen Liu 4 participants 5 messages Nov 29 – Nov 30

Subsystems (3)
lore
Share & tools
lore

Jiawen Liu

author
#0 lore raw

PATCH 1/1 thermal: rcar: handle runtime resume failures during probe

rcar_thermal_probe() ignores the synchronous runtime resume result and continues to sensor MMIO and thermal-zone registration after the PM core reports failure.

Use pm_runtime_resume_and_get(), which retains a usage reference only after a successful resume. On failure, disable runtime PM and return the original error before hardware initialization.

Fixes 51d45d25948b ("thermal: rcar: add pm_runtime_xxx() support")
---
 drivers/thermal/renesas/rcar_thermal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/thermal/renesas/rcar_thermal.c +5 -1
index af6d09a75bb61..c6535b9cdd0fe 100644
@@ -414,7 +414,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	common->dev = dev;
 
 	pm_runtime_enable(dev);
-	pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret) {
+		pm_runtime_disable(dev);
+		return ret;
+	}
 
 	for (i = 0; i < chip->nirqs; i++) {
 		int irq;
Signature · 1 line
2.34.1
#1 lore raw

Hi Jiawen Liu,

Thanks for the patch.

Quoted 22 lines

-----Original Message-----
From: Jiawen Liu <[email protected]>
Sent: 29 November 2026 13:03
Subject: [PATCH] thermal: rcar: handle runtime resume failures during probe

rcar_thermal_probe() ignores the synchronous runtime resume result and continues to sensor MMIO and thermal-zone registration after the PM core reports failure.

Use pm_runtime_resume_and_get(), which retains a usage reference only after a successful resume. On failure, disable runtime PM and return the original error before hardware initialization.

Fixes 51d45d25948b ("thermal: rcar: add pm_runtime_xxx() support")
---
 drivers/thermal/renesas/rcar_thermal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/thermal/renesas/rcar_thermal.c +0 -0
index af6d09a75bb61..c6535b9cdd0fe 100644

drivers/thermal/renesas/rcar_thermal.c static int rcar_thermal_probe(struct platform_device *pdev) · line 419

Quoted 7 lines
drivers/thermal/renesas/rcar_thermal.c +3 -1
@@ -414,7 +414,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	common->dev = dev;
 
 	pm_runtime_enable(dev);
-	pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret) {
+		pm_runtime_disable(dev);

If you use devm_pm_runtime_enable() then you can drop the above.

Cheers,
Biju

Quoted 8 lines
drivers/thermal/renesas/rcar_thermal.c +2 -1
+		return ret;
+	}
 
 	for (i = 0; i < chip->nirqs; i++) {
 		int irq;
--

2.34.1

maintainer
#2 lore raw

Hello,

Quoted 28 lines · Biju Das

Hi Jiawen Liu,

Thanks for the patch.

Quoted 24 lines

-----Original Message-----
From: Jiawen Liu <[email protected]>
Sent: 29 November 2026 13:03
Subject: [PATCH] thermal: rcar: handle runtime resume failures during probe

rcar_thermal_probe() ignores the synchronous runtime resume result and continues to sensor MMIO and thermal-zone registration after the PM core reports failure.

Use pm_runtime_resume_and_get(), which retains a usage reference only after a successful resume. On failure, disable runtime PM and return the original error before hardware initialization.

Fixes 51d45d25948b ("thermal: rcar: add pm_runtime_xxx() support")
---
 drivers/thermal/renesas/rcar_thermal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/thermal/renesas/rcar_thermal.c +0 -0
index af6d09a75bb61..c6535b9cdd0fe 100644
@@ -414,7 +414,11 @@ static int rcar_thermal_probe(struct platform_device *pdev)
 	common->dev = dev;
 
Quoted 8 lines

drivers/thermal/renesas/rcar_thermal.c static int rcar_thermal_probe(struct platform_device *pdev) · line 419

Quoted 5 lines
drivers/thermal/renesas/rcar_thermal.c +3 -1
 	pm_runtime_enable(dev);
-	pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret) {
+		pm_runtime_disable(dev);

If you use devm_pm_runtime_enable() then you can drop the above.

I think I would prefer that, and the commit message update suggested by Geert.

Quoted 13 lines

Cheers,
Biju

Quoted 8 lines
drivers/thermal/renesas/rcar_thermal.c +2 -1
+		return ret;
+	}
 
 	for (i = 0; i < chip->nirqs; i++) {
 		int irq;
--

2.34.1

Signature · 2 lines
Kind Regards,
Niklas Söderlund
author
#3 lore raw

Hi Niklas, Biju and Geert,

I'll use devm_pm_runtime_enable() in v2 and check its return value. That lets me drop the explicit pm_runtime_disable(), including the one in rcar_thermal_remove(). The pm_runtime_put() there still balances the reference acquired by a successful pm_runtime_resume_and_get().

I'll also reword the commit message to describe what probe would do if resume failed. I don't have a report of that failure on R-Car hardware.

Thanks,
Jiawen

#4 lore raw
In reply to Jiawen Liu

Hi Jiawen,

Thanks for your patch!

Quoted 3 lines · Jiawen Liu

rcar_thermal_probe() ignores the synchronous runtime resume result and continues to sensor MMIO and thermal-zone registration after the PM core reports failure.

This sounds like the failure does happen, followed by Bad Things. In practice, pm_runtime_get_sync() cannot fail on R-Car systems. So please write "If it fails...".

Quoted 29 lines

Use pm_runtime_resume_and_get(), which retains a usage reference only after a successful resume. On failure, disable runtime PM and return the original error before hardware initialization.

Fixes 51d45d25948b ("thermal: rcar: add pm_runtime_xxx() support")
---
 drivers/thermal/renesas/rcar_thermal.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/thermal/renesas/rcar_thermal.c +5 -1
index af6d09a75bb61..c6535b9cdd0fe 100644
@@ -414,7 +414,11 @@ static int rcar_thermal_probe(struct 
 platform_device *pdev)
 	common->dev = dev;
 
 	pm_runtime_enable(dev);
-	pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
+	if (ret) {
+		pm_runtime_disable(dev);
+		return ret;
+	}
 
 	for (i = 0; i < chip->nirqs; i++) {
Quoted 1 line

int irq;

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds