Commit 241e99db authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 6014e75e bbde1468
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -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)
+2 −0
Original line number Diff line number Diff line
@@ -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 = {
+14 −15
Original line number Diff line number Diff line
@@ -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;
}