mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yige Jiang <yigejiang86@gmail.com>
To: Ulf Hansson <ulfh@kernel.org>, Frank Li <Frank.Li@nxp.com>
Cc: Yige Jiang <yigejiang86@gmail.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	linux-pm@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH] pmdomain: imx: gpcv2: Take a reference to each PGC node
Date: Tue, 24 Nov 2026 01:19:23 +0800	[thread overview]
Message-ID: <confirmed-20261105-18-6a8421e1b241@gmail.com> (raw)

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@kernel.org>
Closes: https://lore.kernel.org/r/20260530004541.E04701F00898@smtp.kernel.org/
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
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

                 reply	other threads:[~2026-11-23 17:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=confirmed-20261105-18-6a8421e1b241@gmail.com \
    --to=yigejiang86@gmail.com \
    --cc=Frank.Li@nxp.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sashiko-bot@kernel.org \
    --cc=ulfh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®