diff mbox series

[4/8] clk: qcom: gcc-sc8280xp: fix runtime PM imbalance on probe errors

Message ID 20230718132902.21430-5-johan+linaro@kernel.org
State Accepted
Commit 10192ab375c39c58d39cba028d9685cefe1ca3c2
Headers show
Series clk: qcom: fix runtime PM bugs | expand

Commit Message

Johan Hovold July 18, 2023, 1:28 p.m. UTC
Make sure to decrement the runtime PM usage count before returning in
case RCG dynamic frequency switch initialisation fails.

Fixes: 2a541abd9837 ("clk: qcom: gcc-sc8280xp: Add runtime PM")
Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/clk/qcom/gcc-sc8280xp.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Comments

Johan Hovold July 19, 2023, 7:09 a.m. UTC | #1
On Tue, Jul 18, 2023 at 03:28:58PM +0200, Johan Hovold wrote:
> Make sure to decrement the runtime PM usage count before returning in
> case RCG dynamic frequency switch initialisation fails.
> 
> Fixes: 2a541abd9837 ("clk: qcom: gcc-sc8280xp: Add runtime PM")

I noticed you merged these for 6.6 instead of 6.5 as I had expected.

Note that I left out the stable tag here as the offending patch was
merged as a fix for 6.5 and I specifically assumed this fixup would go
in as a fix for 6.5 as well.

> Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>

Johan
diff mbox series

Patch

diff --git a/drivers/clk/qcom/gcc-sc8280xp.c b/drivers/clk/qcom/gcc-sc8280xp.c
index 1fb6ffac730c..ac6f8c0c1ccb 100644
--- a/drivers/clk/qcom/gcc-sc8280xp.c
+++ b/drivers/clk/qcom/gcc-sc8280xp.c
@@ -7539,8 +7539,8 @@  static int gcc_sc8280xp_probe(struct platform_device *pdev)
 
 	regmap = qcom_cc_map(pdev, &gcc_sc8280xp_desc);
 	if (IS_ERR(regmap)) {
-		pm_runtime_put(&pdev->dev);
-		return PTR_ERR(regmap);
+		ret = PTR_ERR(regmap);
+		goto err_put_rpm;
 	}
 
 	/*
@@ -7561,11 +7561,19 @@  static int gcc_sc8280xp_probe(struct platform_device *pdev)
 
 	ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks, ARRAY_SIZE(gcc_dfs_clocks));
 	if (ret)
-		return ret;
+		goto err_put_rpm;
 
 	ret = qcom_cc_really_probe(pdev, &gcc_sc8280xp_desc, regmap);
+	if (ret)
+		goto err_put_rpm;
+
 	pm_runtime_put(&pdev->dev);
 
+	return 0;
+
+err_put_rpm:
+	pm_runtime_put_sync(&pdev->dev);
+
 	return ret;
 }