Subject: Re: [PATCH v3 00/10] pmdomain: samsung: add supoort for Google GS101

From: Marek Szyprowski <[email-masked]>
Date: Fri, 17 Oct 2025 08:43:24 +0200

On 16.10.2025 17:58, André Draszik wrote:
> This series adds support for the power domains on Google GS101. It's
> fairly similar to SoCs already supported by this driver, except that
> register acces does not work via plain ioremap() / readl() / writel().
> Instead, the regmap created by the PMU driver must be used (which uses
> Arm SMCC calls under the hood).
>
> The DT update to add the new required properties on gs101 will be
> posted separately.
>
> Signed-off-by: André Draszik <[email-masked]>

Works fine on existing Exynos based boards.

Tested-by: Marek Szyprowski <[email-masked]>

> ---
> Changes in v3:
> - use additionalProperties, not unevaluatedProperties in patch 2
> - fix path in $id in patch 2 (Rob)
> - drop comment around 'select' in patch 2 (Rob)
> - collect tags
> - Link to v2: https://lore.kernel.org/r/[email-masked]
>
> Changes in v2:
> - Krzysztof:
>    - move google,gs101-pmu binding into separate file
>    - mark devm_kstrdup_const() patch as fix
>    - use bool for need_early_sync_state
>    - merge patches 8 and 10 from v1 series into one patch
> - collect tags
> - Link to v1: https://lore.kernel.org/r/[email-masked]
>
> ---
> André Draszik (10):
>        dt-bindings: power: samsung: add google,gs101-pd
>        dt-bindings: soc: samsung: exynos-pmu: move gs101-pmu into separate binding
>        dt-bindings: soc: samsung: gs101-pmu: allow power domains as children
>        pmdomain: samsung: plug potential memleak during probe
>        pmdomain: samsung: convert to using regmap
>        pmdomain: samsung: convert to regmap_read_poll_timeout()
>        pmdomain: samsung: don't hardcode offset for registers to 0 and 4
>        pmdomain: samsung: selectively handle enforced sync_state
>        pmdomain: samsung: add support for google,gs101-pd
>        pmdomain: samsung: use dev_err() instead of pr_err()
>
>   .../devicetree/bindings/power/pd-samsung.yaml      |   1 +
>   .../bindings/soc/google/google,gs101-pmu.yaml      | 106 +++++++++++++++++
>   .../bindings/soc/samsung/exynos-pmu.yaml           |  20 ----
>   MAINTAINERS                                        |   1 +
>   drivers/pmdomain/samsung/exynos-pm-domains.c       | 126 +++++++++++++++------
>   5 files changed, 200 insertions(+), 54 deletions(-)
> ---
> base-commit: 58e817956925fdc12c61f1cb86915b82ae1603c1
> change-id: 20251001-gs101-pd-d4dc97d70a84

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland

---

From: André Draszik <[email-masked]>
Date: Thu, 16 Oct 2025 16:58:33 +0100

Hi,

Changes in v2:
- Krzysztof:

---
André Draszik (10):

Best regards,
-- 
André Draszik <[email-masked]>

---

From: André Draszik <[email-masked]>
Date: Thu, 16 Oct 2025 16:58:37 +0100

of_genpd_add_provider_simple() could fail, in which case this code
leaks the domain name, pd->pd.name.

Use devm_kstrdup_const() to plug this leak. As a side-effect, we can
simplify existing error handling.

Fixes: c09a3e6c97f0 ("soc: samsung: pm_domains: Convert to regular platform driver")
Cc: [email-masked]
Reviewed-by: Peter Griffin <[email-masked]>
Reviewed-by: Krzysztof Kozlowski <[email-masked]>
Signed-off-by: André Draszik <[email-masked]>
---
v2:
mark as fix, as this isn't a pure simplification
---
 drivers/pmdomain/samsung/exynos-pm-domains.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/pmdomain/samsung/exynos-pm-domains.c b/drivers/pmdomain/samsung/exynos-pm-domains.c
index 5d478bb37ad68afc7aed7c6ae19b5fefc94a9035..f53e1bd2479807988f969774b4b7b4c5739c1aba 100644
--- a/drivers/pmdomain/samsung/exynos-pm-domains.c
+++ b/drivers/pmdomain/samsung/exynos-pm-domains.c
@@ -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,15 +116,13 @@ 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;

-- 
2.51.0.788.g6d19910ace-goog