pmdomain providers:

- imx: Fix reference count leak in ->remove()
  - samsung: Rework legacy splash-screen handover workaround
  - samsung: Fix potential memleak during ->probe()
  - arm: Fix genpd leak on provider registration failure for scmi
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCgA1FiEEugLDXPmKSktSkQsV/iaEJXNYjCkFAmkXVCkXHHVsZi5oYW5z
 c29uQGxpbmFyby5vcmcACgkQ/iaEJXNYjCkfsg/+Jl5eA/yPBcIBarNR57zVVw7+
 AkR6Swf1nqWBsbsSzI+5glSMvt8zvdK5xAbLJ4FgTXZG8lZAhDrYQW487kLW2T3x
 ovc+EnoN++nEgbtQSawda7zIkoQTnDbmv63M3hcV8+r4i0fpLizgruAnn2hXl+Rz
 75n2jMVYpbCQwKdtvPF8GJxOgcxqAwWoZF/mq2ZgRJZAMsRCBNtfhnGOLss0nB38
 g15WC6KQw7rQGBiNNkWkSsXXFL1DIypHaXyc50ckIz07tndzj9D2jLbinv85H4Bc
 oM0PMCpfabMM53uIq451CLil3hBkjFWC7sxL4hY3egWnGq1+Ng1SOCom4u7Sq0LW
 2MmK9YoDNB8HrGfK8KXJhseHwdB4nyhBTBPQPr2QED4w668I1ItJIQh8MD/5zZrd
 LfB/pDBpbTxob7sCHBuENS9HOp0Cq3PRkDjw8U1PaFqm7/9VuHcXXTqLFLbngUJ2
 UzOUileCc0XlHe/S1NESe8ddvgbtvxjm9mtPwLCLXQDpQSy9pBkqLU8ApnsqJkH3
 xCEE+T6EADqkHMGDyMjMO1RdvCWVmdVCApX/tinxuSQ62r98gUCs7zjc9SI1dJr6
 NHROUkVd02e2iMRSGASgpFsb+1BHhPizeNAtFLRJq5p8l1fTR3+mRaL8mQ33Uj7r
 g7weleTpL/3nxyrkXT4=
 =kbt7
 -----END PGP SIGNATURE-----

Merge tag 'pmdomain-v6.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm

Pull pmdomain fixes from Ulf Hansson:

 - imx: Fix reference count leak in ->remove()

 - samsung: Rework legacy splash-screen handover workaround

 - samsung: Fix potential memleak during ->probe()

 - arm: Fix genpd leak on provider registration failure for scmi

* tag 'pmdomain-v6.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/linux-pm:
  pmdomain: imx: Fix reference count leak in imx_gpc_remove
  pmdomain: samsung: Rework legacy splash-screen handover workaround
  pmdomain: arm: scmi: Fix genpd leak on provider registration failure
  pmdomain: samsung: plug potential memleak during probe
This commit is contained in:
Linus Torvalds 2025-11-14 13:29:15 -08:00
commit 241e99dbdc
3 changed files with 27 additions and 17 deletions

View File

@ -41,7 +41,7 @@ static int scmi_pd_power_off(struct generic_pm_domain *domain)
static int scmi_pm_domain_probe(struct scmi_device *sdev)
{
int num_domains, i;
int num_domains, i, ret;
struct device *dev = &sdev->dev;
struct device_node *np = dev->of_node;
struct scmi_pm_domain *scmi_pd;
@ -108,9 +108,18 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
scmi_pd_data->domains = domains;
scmi_pd_data->num_domains = num_domains;
ret = of_genpd_add_provider_onecell(np, scmi_pd_data);
if (ret)
goto err_rm_genpds;
dev_set_drvdata(dev, scmi_pd_data);
return of_genpd_add_provider_onecell(np, scmi_pd_data);
return 0;
err_rm_genpds:
for (i = num_domains - 1; i >= 0; i--)
pm_genpd_remove(domains[i]);
return ret;
}
static void scmi_pm_domain_remove(struct scmi_device *sdev)

View File

@ -536,6 +536,8 @@ static void imx_gpc_remove(struct platform_device *pdev)
return;
}
}
of_node_put(pgc_node);
}
static struct platform_driver imx_gpc_driver = {

View File

@ -92,13 +92,14 @@ static const struct of_device_id exynos_pm_domain_of_match[] = {
{ },
};
static const char *exynos_get_domain_name(struct device_node *node)
static const char *exynos_get_domain_name(struct device *dev,
struct device_node *node)
{
const char *name;
if (of_property_read_string(node, "label", &name) < 0)
name = kbasename(node->full_name);
return kstrdup_const(name, GFP_KERNEL);
return devm_kstrdup_const(dev, name, GFP_KERNEL);
}
static int exynos_pd_probe(struct platform_device *pdev)
@ -115,20 +116,27 @@ static int exynos_pd_probe(struct platform_device *pdev)
if (!pd)
return -ENOMEM;
pd->pd.name = exynos_get_domain_name(np);
pd->pd.name = exynos_get_domain_name(dev, np);
if (!pd->pd.name)
return -ENOMEM;
pd->base = of_iomap(np, 0);
if (!pd->base) {
kfree_const(pd->pd.name);
if (!pd->base)
return -ENODEV;
}
pd->pd.power_off = exynos_pd_power_off;
pd->pd.power_on = exynos_pd_power_on;
pd->local_pwr_cfg = pm_domain_cfg->local_pwr_cfg;
/*
* Some Samsung platforms with bootloaders turning on the splash-screen
* and handing it over to the kernel, requires the power-domains to be
* reset during boot.
*/
if (IS_ENABLED(CONFIG_ARM) &&
of_device_is_compatible(np, "samsung,exynos4210-pd"))
exynos_pd_power_off(&pd->pd);
on = readl_relaxed(pd->base + 0x4) & pd->local_pwr_cfg;
pm_genpd_init(&pd->pd, NULL, !on);
@ -147,15 +155,6 @@ static int exynos_pd_probe(struct platform_device *pdev)
parent.np, child.np);
}
/*
* Some Samsung platforms with bootloaders turning on the splash-screen
* and handing it over to the kernel, requires the power-domains to be
* reset during boot. As a temporary hack to manage this, let's enforce
* a sync_state.
*/
if (!ret)
of_genpd_sync_state(np);
pm_runtime_enable(dev);
return ret;
}