diff options
author | Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp> | 2024-12-15 12:01:59 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-01-09 13:33:32 +0100 |
commit | a45ae89327892d5856b50b3fa8a7f2ac72ec309f (patch) | |
tree | ad661cc2a9636d4bf7235ffa82180a6982ba6351 | |
parent | 1595afae01faabbc3d4ff77df76f27bfa5da7a14 (diff) |
pmdomain: imx: gpcv2: fix an OF node reference leak in imx_gpcv2_probe()
commit 469c0682e03d67d8dc970ecaa70c2d753057c7c0 upstream.
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@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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/pmdomain/imx/gpcv2.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c index 3f0e6960f47f..e03c2cb39a69 100644 --- a/drivers/pmdomain/imx/gpcv2.c +++ b/drivers/pmdomain/imx/gpcv2.c @@ -1458,12 +1458,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; |