Skip to contentSkip to conversation

soc: mediatek: fix missing clk_disable_unprepare() on err in svs_resume()

PATCH Applied Peng Wu 2 participants 2 messages Jun 23, 2022 Arm MediaTek

lore
Share & tools
lore

Peng Wu

author
#0 lore raw

PATCH v2 1/1 soc: mediatek: fix missing clk_disable_unprepare() on err in svs_resume()

Fix the missing clk_disable_unprepare() before return from svs_resume() in the error handling case.

---
v2:
- Same holds for the error path of svs_init02().

---
 drivers/soc/mediatek/mtk-svs.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/soc/mediatek/mtk-svs.c +6 -2
index 606a00a2e57d..87e05ab51552 100644
@@ -1526,16 +1526,20 @@ static int svs_resume(struct device *dev)
 	ret = reset_control_deassert(svsp->rst);
 	if (ret) {
 		dev_err(svsp->dev, "cannot deassert reset %d\n", ret);
-		return ret;
+		goto out_of_resume;
 	}
 
 	ret = svs_init02(svsp);
 	if (ret)
-		return ret;
+		goto out_of_resume;
 
 	svs_mon_mode(svsp);
 
 	return 0;
+
+out_of_resume:
+	clk_disable_unprepare(svsp->main_clk);
+	return ret;
 }
 
 static int svs_bank_resource_setup(struct svs_platform *svsp)
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Peng Wu

Fix the missing clk_disable_unprepare() before return from svs_resume() in the error handling case.

Applied, thanks!

Quoted 34 lines

---
v2:
- Same holds for the error path of svs_init02().

---
  drivers/soc/mediatek/mtk-svs.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/soc/mediatek/mtk-svs.c +6 -2
index 606a00a2e57d..87e05ab51552 100644
@@ -1526,16 +1526,20 @@ static int svs_resume(struct device *dev)
  	ret = reset_control_deassert(svsp->rst);
  	if (ret) {
  		dev_err(svsp->dev, "cannot deassert reset %d\n", ret);
-		return ret;
+		goto out_of_resume;
  	}
 
  	ret = svs_init02(svsp);
  	if (ret)
-		return ret;
+		goto out_of_resume;
 
  	svs_mon_mode(svsp);
 
  	return 0;
+
+out_of_resume:
+	clk_disable_unprepare(svsp->main_clk);
+	return ret;
  }
 
  static int svs_bank_resource_setup(struct svs_platform *svsp)