This is a note to let you know that I've just added the patch titled pmdomain: imx: gpcv2: fix an OF node reference leak in imx_gpcv2_probe() to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: pmdomain-imx-gpcv2-fix-an-of-node-reference-leak-in-.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit d9d195cfa7d24b24136ff740018acb5bfda88a76 Author: Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx> Date: Sun Dec 15 12:01:59 2024 +0900 pmdomain: imx: gpcv2: fix an OF node reference leak in imx_gpcv2_probe() [ Upstream commit 469c0682e03d67d8dc970ecaa70c2d753057c7c0 ] imx_gpcv2_probe() leaks an OF node reference obtained by of_get_child_by_name(). Fix it by declaring the device node with the __free(device_node) cleanup construct. This bug was found by an experimental static analysis tool that I am developing. Fixes: 03aa12629fc4 ("soc: imx: Add GPCv2 power gating driver") Signed-off-by: Joe Hattori <joe@xxxxxxxxxxxxxxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Message-ID: <20241215030159.1526624-1-joe@xxxxxxxxxxxxxxxxxxxxx> Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c index ec789bf92274..13fce2b134f6 100644 --- a/drivers/pmdomain/imx/gpcv2.c +++ b/drivers/pmdomain/imx/gpcv2.c @@ -1449,12 +1449,12 @@ static int imx_gpcv2_probe(struct platform_device *pdev) .max_register = SZ_4K, }; struct device *dev = &pdev->dev; - struct device_node *pgc_np; + struct device_node *pgc_np __free(device_node) = + of_get_child_by_name(dev->of_node, "pgc"); struct regmap *regmap; void __iomem *base; int ret; - pgc_np = of_get_child_by_name(dev->of_node, "pgc"); if (!pgc_np) { dev_err(dev, "No power domains specified in DT\n"); return -EINVAL;