summaryrefslogtreecommitdiff
path: root/drivers/pmdomain
diff options
context:
space:
mode:
authorPengpeng Hou <hppiscas@163.com>2026-09-06 11:38:06 +0800
committerUlf Hansson <ulfh@kernel.org>2026-09-21 13:41:03 +0200
commitd3efba7921f3ebebd91fc481910a428c78414fd8 (patch)
tree2da9a19d81f699d2524842058c85fce5b933ef37 /drivers/pmdomain
parentcbd916ef0c7794993aafbf781ae018c3a8f3c02e (diff)
downloadlinux-next-d3efba7921f3ebebd91fc481910a428c78414fd8.tar.gz
linux-next-d3efba7921f3ebebd91fc481910a428c78414fd8.zip
pmdomain: imx: Propagate SCU provider registration failures
imx_scu_init_pm_domains() ignores of_genpd_add_provider_onecell() and returns success even when none of the initialized domains are published to DT consumers. Return the provider error and remove the initialized domains in reverse order before devm releases their backing storage on probe failure. The issue was found by our static-analysis tool and manually reviewed. Fixes: c800cd7824bd ("firmware: imx: add SCU power domain driver") Assisted-by: gpt 5 Signed-off-by: Pengpeng Hou <hppiscas@163.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
Diffstat (limited to 'drivers/pmdomain')
-rw-r--r--drivers/pmdomain/imx/scu-pd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/pmdomain/imx/scu-pd.c b/drivers/pmdomain/imx/scu-pd.c
index e3f9e741daf7..05d4364f34be 100644
--- a/drivers/pmdomain/imx/scu-pd.c
+++ b/drivers/pmdomain/imx/scu-pd.c
@@ -474,7 +474,7 @@ static int imx_scu_init_pm_domains(struct device *dev,
struct genpd_onecell_data *pd_data;
struct imx_sc_pm_domain *sc_pd;
u32 count = 0;
- int i, j;
+ int i, j, ret;
for (i = 0; i < pd_soc->num_ranges; i++)
count += pd_ranges[i].num;
@@ -503,7 +503,13 @@ static int imx_scu_init_pm_domains(struct device *dev,
pd_data->num_domains = count;
pd_data->xlate = imx_scu_pd_xlate;
- of_genpd_add_provider_onecell(dev->of_node, pd_data);
+ ret = of_genpd_add_provider_onecell(dev->of_node, pd_data);
+ if (ret) {
+ while (count)
+ pm_genpd_remove(domains[--count]);
+
+ return ret;
+ }
return 0;
}