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

* Re: [PATCH] clk: qcom: gdsc: Fix error path on registration of multiple pm subdomains
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2026-03-28 11:34 UTC (permalink / raw)
  To: Vladimir Zapolskiy, Bjorn Andersson
  Cc: Michael Turquette, Stephen Boyd, linux-arm-msm, linux-clk

On 28/03/2026 01:26, Vladimir Zapolskiy wrote:
> 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,

Reviewed-by: Bryan O'Donoghue <bod@kernel.org>

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

* Re: [PATCH] clk: qcom: gdsc: Fix error path on registration of multiple pm subdomains
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2026-03-29 10:53 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Bjorn Andersson, Michael Turquette, Stephen Boyd,
	Bryan O'Donoghue, linux-arm-msm, linux-clk

On Sat, Mar 28, 2026 at 03:26:19AM +0200, Vladimir Zapolskiy wrote:
> 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(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry

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

* Re: [PATCH] clk: qcom: gdsc: Fix error path on registration of multiple pm subdomains
  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
  2 siblings, 0 replies; 4+ messages in thread
From: Bjorn Andersson @ 2026-03-30 16:01 UTC (permalink / raw)
  To: Vladimir Zapolskiy
  Cc: Michael Turquette, Stephen Boyd, Bryan O'Donoghue,
	linux-arm-msm, linux-clk


On Sat, 28 Mar 2026 03:26:19 +0200, Vladimir Zapolskiy wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] clk: qcom: gdsc: Fix error path on registration of multiple pm subdomains
      commit: 16ba98dace9e7cfe25ad8a314e34befacd91f86f

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

^ permalink raw reply	[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