Skip to contentSkip to conversation

amba: Fix pclk leak on runtime resume failure

PATCH New Yuho Choi 1 participant 1 message Jul 7 Arm primecell bus support

lore
Share & tools
lore

Yuho Choi

author
#0 lore raw

PATCH 1/1 amba: Fix pclk leak on runtime resume failure

amba_pm_runtime_resume() enables the AMBA pclk before calling the driver runtime resume callback. If that callback fails, the function returns with pclk still enabled.

Disable pclk on pm_generic_runtime_resume() failure, matching the clock state rollback expected by the runtime suspend/resume path.

Fixes 92b97f0aaccb ("PM: add runtime PM support to core Primecell driver")
---
 drivers/amba/bus.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/amba/bus.c +9 -1
index d721d64a9858..5a36463f1438 100644
@@ -389,7 +389,15 @@ static int amba_pm_runtime_resume(struct device *dev)
 			return ret;
 	}
 
-	return pm_generic_runtime_resume(dev);
+	ret = pm_generic_runtime_resume(dev);
+	if (ret && dev->driver) {
+		if (pm_runtime_is_irq_safe(dev))
+			clk_disable(pcdev->pclk);
+		else
+			clk_disable_unprepare(pcdev->pclk);
+	}
+
+	return ret;
 }
 #endif /* CONFIG_PM */
 
Signature · 1 line
2.43.0