Skip to contentSkip to conversation

Add missing icc_disable in exit path

PATCH Applied Andi Shyti 1 participant 5 messages Aug 12, 2024 – Aug 21, 2024

Subsystems (4)
lore
Share & tools
lore

Andi Shyti

author maintainer
#0 lore raw

cover Add missing icc_disable in exit path

Hi,

Last week I committed the following patches from Gaosheng:

9ba48db9f77ce i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume b93d16bee5573 i2c: qcom-geni: Add missing clk_disable_unprepare in geni_i2c_runtime_resume

that wanted to add some cleanups in the geni_i2c_runtime_resume() exit path. However, one case was overlooked. While addressing this, I also replaced multiple return statements with a single goto exit to improve code clarity and consistency.

I decided to keep the patches separate because the first patch applies cleanly to the stable branch, whereas merging them into a single patch would have created complications for backporting.

Thanks,
Andi

Cc Bjorn Andersson <[email protected]>
Cc Gaosheng Cui <[email protected]>
Cc Konrad Dybcio <[email protected]>
Cc Vladimir Zapolskiy <[email protected]>

Andi Shyti (2):
i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume
i2c: qcom-geni: Use goto for clearer exit path

 drivers/i2c/busses/i2c-qcom-geni.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
Signature · 1 line
2.45.2
author maintainer
#1 lore raw

PATCH 1/2 i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume

Add the missing geni_icc_disable() call before returning in the geni_i2c_runtime_resume() function.

Commit 9ba48db9f77c ("i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume") by Gaosheng missed disabling the interconnect in one case.

Fixes bf225ed357c6 ("i2c: i2c-qcom-geni: Add interconnect support")
Cc Gaosheng Cui <[email protected]>
Cc <[email protected]> # v5.9+

---
Cc: Bjorn Andersson <[email protected]>
Cc: Konrad Dybcio <[email protected]>
Cc: Vladimir Zapolskiy <[email protected]>

 drivers/i2c/busses/i2c-qcom-geni.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-qcom-geni.c +3 -1
index 365e37bba0f33..06e836e3e8773 100644
@@ -986,8 +986,10 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev)
 		return ret;
 
 	ret = clk_prepare_enable(gi2c->core_clk);
-	if (ret)
+	if (ret) {
+		geni_icc_disable(&gi2c->se);
 		return ret;
+	}
 
 	ret = geni_se_resources_on(&gi2c->se);
 	if (ret) {
Signature · 1 line
2.45.2
author maintainer
#2 lore raw

PATCH 2/2 i2c: qcom-geni: Use goto for clearer exit path

In reply to Andi Shyti

Refactor the code by using goto statements to reduce duplication and make the exit path clearer.

---
Cc: Bjorn Andersson <[email protected]>
Cc: Gaosheng Cui <[email protected]>
Cc: Konrad Dybcio <[email protected]>
Cc: Vladimir Zapolskiy <[email protected]>

 drivers/i2c/busses/i2c-qcom-geni.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +12 -9
index 06e836e3e8773..ebb5900fd3227 100644
@@ -986,21 +986,24 @@ static int __maybe_unused geni_i2c_runtime_resume(struct device *dev)
 		return ret;
 
 	ret = clk_prepare_enable(gi2c->core_clk);
-	if (ret) {
-		geni_icc_disable(&gi2c->se);
-		return ret;
-	}
+	if (ret)
+		goto out_icc_disable;
 
 	ret = geni_se_resources_on(&gi2c->se);
-	if (ret) {
-		clk_disable_unprepare(gi2c->core_clk);
-		geni_icc_disable(&gi2c->se);
-		return ret;
-	}
+	if (ret)
+		goto out_clk_disable;
 
 	enable_irq(gi2c->irq);
 	gi2c->suspended = 0;
+
 	return 0;
+
+out_clk_disable:
+	clk_disable_unprepare(gi2c->core_clk);
+out_icc_disable:
+	geni_icc_disable(&gi2c->se);
+
+	return ret;
 }
 
 static int __maybe_unused geni_i2c_suspend_noirq(struct device *dev)
Signature · 1 line
2.45.2
author maintainer Applied
#3 lore raw

Re: [PATCH 2/2] i2c: qcom-geni: Use goto for clearer exit path

Quoted 4 lines · Andi Shyti

Refactor the code by using goto statements to reduce duplication and make the exit path clearer.

merged to i2c/i2c-host.

Andi

author maintainer
#4 lore raw
In reply to Andi Shyti

Hi,

Quoted 2 lines

Andi Shyti (2):
i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume

Because this was a fix I merged it...

Quoted 1 line

i2c: qcom-geni: Use goto for clearer exit path

... I leave this one for more comment opportunities.

Andi