Re: [PATCH] pmdomain: imx: gpcv2: Take a reference to each PGC node
From: Ulf Hansson
Date: Thu Nov 26 2026 - 08:32:11 EST
On Mon, Nov 23, 2026 at 6:19 PM Yige Jiang <yigejiang86@xxxxxxxxx> wrote:
>
> The child-node iterator owns the reference to each PGC node, but
> imx_gpcv2_probe() assigns the node to a newly allocated platform device
> without taking another reference. If platform_device_add() fails,
> platform_device_put() releases the node through platform_device_release(),
> and the iterator then drops the same reference again.
>
> Use platform_device_set_of_node() to give the child device its own node
> reference, paired with the put in platform_device_release().
>
> Fixes: 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver")
> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> Closes: https://lore.kernel.org/r/20260530004541.E04701F00898@xxxxxxxxxxxxxxx/
> Signed-off-by: Yige Jiang <yigejiang86@xxxxxxxxx>
Applied for fixes and by adding a stable tag, thanks!
Kind regards
Uffe
> ---
> AI assistance was used for analysis and patch preparation.
>
> Based on next-20261104 (8b7179210b22).
> Compile-tested: arm64, GCC 14.2.0, W=1, drivers/pmdomain/imx/gpcv2.o;
> baseline and patched objects built with no warnings.
> Static source review; no hardware, boot, or KASAN test was performed.
>
> drivers/pmdomain/imx/gpcv2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c
> index 6a54ee734514645db7e0628bdddcf579d1f0d904..7b377bf0196491298e9e772b97d15a2bda9ff83a 100644
> --- a/drivers/pmdomain/imx/gpcv2.c
> +++ b/drivers/pmdomain/imx/gpcv2.c
> @@ -1513,7 +1513,7 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
> domain->genpd.power_off = imx_pgc_power_down;
>
> pd_pdev->dev.parent = dev;
> - device_set_node(&pd_pdev->dev, of_fwnode_handle(np));
> + platform_device_set_of_node(pd_pdev, np);
>
> ret = platform_device_add(pd_pdev);
> if (ret) {
>
> base-commit: 8b7179210b22f8e48a82c5ceacb9d56a9c4cfec4