Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH v2] pmdomain: imx: Fix reference count leak in imx_gpc_probe()
@ 2025-12-09  8:19 Wentao Liang
  2025-12-09 16:14 ` Frank Li
  2025-12-10  3:21 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2025-12-09  8:19 UTC (permalink / raw)
  To: ulf.hansson, shawnguo, s.hauer, kernel, festevam
  Cc: linux-pm, imx, linux-arm-kernel, linux-kernel, Wentao Liang,
	stable

of_get_child_by_name() returns a node pointer with refcount incremented,
we should use the __free() attribute to manage the pgc_node reference.
This ensures automatic of_node_put() cleanup when pgc_node goes out of
scope, eliminating the need for explicit error handling paths and
avoiding reference count leaks.

Fixes: 721cabf6c660 ("soc: imx: move PGC handling to a new GPC driver")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

---
Change in V2:
- Use __free() attribute instead of explicit of_node_put() calls
---
 drivers/pmdomain/imx/gpc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pmdomain/imx/gpc.c b/drivers/pmdomain/imx/gpc.c
index f18c7e6e75dd..89d5d68c055d 100644
--- a/drivers/pmdomain/imx/gpc.c
+++ b/drivers/pmdomain/imx/gpc.c
@@ -403,7 +403,7 @@ static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap,
 static int imx_gpc_probe(struct platform_device *pdev)
 {
 	const struct imx_gpc_dt_data *of_id_data = device_get_match_data(&pdev->dev);
-	struct device_node *pgc_node;
+	struct device_node *pgc_node __free(pgc_node);
 	struct regmap *regmap;
 	void __iomem *base;
 	int ret;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-10  3:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-09  8:19 [PATCH v2] pmdomain: imx: Fix reference count leak in imx_gpc_probe() Wentao Liang
2025-12-09 16:14 ` Frank Li
2025-12-10  3:21 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox