Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
* [PATCH] clk: qcom: gdsc: Fix error path on registration of multiple pm subdomains
@ 2026-03-28  1:26 Vladimir Zapolskiy
  2026-03-28 11:34 ` Bryan O'Donoghue
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vladimir Zapolskiy @ 2026-03-28  1:26 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Michael Turquette, Stephen Boyd, Bryan O'Donoghue,
	linux-arm-msm, linux-clk

Some pm subdomains may be left in added to a parent domain state, if
gdsc_add_subdomain_list() function fails in the middle and bails from
a GDSC power domain controller registration out.

Fixes: b489235b4dc0 ("clk: qcom: Support attaching GDSCs to multiple parents")
Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
---
 drivers/clk/qcom/gdsc.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
index 7deabf8400cf..95aa07120245 100644
--- a/drivers/clk/qcom/gdsc.c
+++ b/drivers/clk/qcom/gdsc.c
@@ -518,10 +518,20 @@ static int gdsc_add_subdomain_list(struct dev_pm_domain_list *pd_list,
 
 		ret = pm_genpd_add_subdomain(genpd, subdomain);
 		if (ret)
-			return ret;
+			goto remove_added_subdomains;
 	}
 
 	return 0;
+
+remove_added_subdomains:
+	for (i--; i >= 0; i--) {
+		struct device *dev = pd_list->pd_devs[i];
+		struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain);
+
+		pm_genpd_remove_subdomain(genpd, subdomain);
+	}
+
+	return ret;
 }
 
 static void gdsc_remove_subdomain_list(struct dev_pm_domain_list *pd_list,
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-30 16:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-28  1:26 [PATCH] clk: qcom: gdsc: Fix error path on registration of multiple pm subdomains Vladimir Zapolskiy
2026-03-28 11:34 ` Bryan O'Donoghue
2026-03-29 10:53 ` Dmitry Baryshkov
2026-03-30 16:01 ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox