Skip to content

Commit 66e533f

Browse files
joehattorigregkh
authored andcommitted
pmdomain: imx: gpcv2: fix an OF node reference leak in imx_gpcv2_probe()
[ Upstream commit 469c068 ] 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: 03aa126 ("soc: imx: Add GPCv2 power gating driver") Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp> Cc: stable@vger.kernel.org Message-ID: <20241215030159.1526624-1-joe@pf.is.s.u-tokyo.ac.jp> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b1e6351 commit 66e533f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pmdomain/imx/gpcv2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1449,12 +1449,12 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
14491449
.max_register = SZ_4K,
14501450
};
14511451
struct device *dev = &pdev->dev;
1452-
struct device_node *pgc_np;
1452+
struct device_node *pgc_np __free(device_node) =
1453+
of_get_child_by_name(dev->of_node, "pgc");
14531454
struct regmap *regmap;
14541455
void __iomem *base;
14551456
int ret;
14561457

1457-
pgc_np = of_get_child_by_name(dev->of_node, "pgc");
14581458
if (!pgc_np) {
14591459
dev_err(dev, "No power domains specified in DT\n");
14601460
return -EINVAL;

0 commit comments

Comments
 (0)