Skip to contentSkip to conversation

thermal: rzg3e: Propagate reset assertion failure from suspend

PATCH Applied Pengpeng Hou 2 participants 2 messages Oct 14

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 thermal: rzg3e: Propagate reset assertion failure from suspend

rzg3e_thermal_suspend() powers off an active sensor and then ignores failure to assert its reset. System sleep can therefore continue without the clean reset state expected by resume.

Return the reset error and, when the sensor had been active, try to restore power before failing suspend. This is best-effort recovery:
reset assertion failure may leave partial hardware state, so restoring power is not guaranteed to succeed. Preserve the original reset error.

The issue was found by our static-analysis tool and manually reviewed.

Fixes dc67521c20b7 ("thermal/drivers/renesas/rzg3e: Fix add thermal driver for the Renesas RZ/G3E SoC")
Assisted-by gpt 5

---
Changes since the RFC:
- resend without RFC and add Claudiu's Reviewed-by, as Daniel requested
- add the introducing Fixes tag and clarify the best-effort recovery
- rebase on current mainline; retain the reviewed code

Previous version:
https://lore.kernel.org/all/[email protected]/

 drivers/thermal/renesas/rzg3e_thermal.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/thermal/renesas/rzg3e_thermal.c +7 -3
index c44f5b8858d02a7d4d6a5fbe8a8b189ab22568ba..7686a45341b3dcddccbfee11a7f832f9e1d76a15 100644
@@ -499,15 +499,19 @@ static int rzg3e_thermal_runtime_resume(struct device *dev)
 static int rzg3e_thermal_suspend(struct device *dev)
 {
 	struct rzg3e_thermal_priv *priv = dev_get_drvdata(dev);
+	bool active = pm_runtime_active(dev);
+	int ret;
 
 	/* If device is active, power it off */
-	if (pm_runtime_active(dev))
+	if (active)
 		rzg3e_thermal_power_off(priv);
 
 	/* Assert reset to ensure clean state after resume */
-	reset_control_assert(priv->rstc);
+	ret = reset_control_assert(priv->rstc);
+	if (ret && active)
+		rzg3e_thermal_power_on(priv);
 
-	return 0;
+	return ret;
 }
 
 static int rzg3e_thermal_resume(struct device *dev)

base-commit: 4056b3c9d3c92ea45955641dbafeb9b960e146ef

#1 lore raw

[thermal: thermal/linux-next] thermal/drivers/rzg3e: Propagate reset assertion failure from suspend

The following commit has been merged into the thermal/linux-next branch of thermal:

The following commit has been merged into the thermal/linux-next branch of thermal:

Commit-ID:     2dc1f296b5754dd2441fc8b6613a362a47f6b98f
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//2dc1f296b5754dd2441fc8b6613a362a47f6b98f
Author:        Pengpeng Hou <[email protected]>
AuthorDate:    Wed, 14 Oct 2026 11:18:14 +08:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Wed, 14 Oct 2026 09:46:07 +02:00

thermal/drivers/rzg3e: Propagate reset assertion failure from suspend

rzg3e_thermal_suspend() powers off an active sensor and then ignores failure to assert its reset. System sleep can therefore continue without the clean reset state expected by resume.

Return the reset error and, when the sensor had been active, try to restore power before failing suspend. This is best-effort recovery:
reset assertion failure may leave partial hardware state, so restoring power is not guaranteed to succeed. Preserve the original reset error.

The issue was found by our static-analysis tool and manually reviewed.

Fixes dc67521c20b7 ("thermal/drivers/renesas/rzg3e: Fix add thermal driver for the Renesas RZ/G3E SoC")
Assisted-by gpt 5
---
 drivers/thermal/renesas/rzg3e_thermal.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/thermal/renesas/rzg3e_thermal.c +7 -3
index a1ceff7..e806d13 100644
@@ -512,15 +512,19 @@ static int rzg3e_thermal_runtime_resume(struct device *dev)
 static int rzg3e_thermal_suspend(struct device *dev)
 {
 	struct rzg3e_thermal_priv *priv = dev_get_drvdata(dev);
+	bool active = pm_runtime_active(dev);
+	int ret;
 
 	/* If device is active, power it off */
-	if (pm_runtime_active(dev))
+	if (active)
 		rzg3e_thermal_power_off(priv);
 
 	/* Assert reset to ensure clean state after resume */
-	reset_control_assert(priv->rstc);
+	ret = reset_control_assert(priv->rstc);
+	if (ret && active)
+		rzg3e_thermal_power_on(priv);
 
-	return 0;
+	return ret;
 }
 
 static int rzg3e_thermal_resume(struct device *dev)