Commit 16ba98da authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by Bjorn Andersson
Browse files

clk: qcom: gdsc: Fix error path on registration of multiple pm subdomains



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: b489235b ("clk: qcom: Support attaching GDSCs to multiple parents")
Signed-off-by: default avatarVladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: default avatarBryan O'Donoghue <bod@kernel.org>
Link: https://lore.kernel.org/r/20260328012619.832770-1-vladimir.zapolskiy@linaro.org


Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent c412c6b1
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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,