mirror of https://github.com/torvalds/linux.git
pmdomain: imx: gpcv2: fix an OF node reference leak in imx_gpcv2_probe()
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: 03aa12629f ("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>
This commit is contained in:
parent
fac04efc5c
commit
469c0682e0
|
|
@ -1458,12 +1458,12 @@ static int imx_gpcv2_probe(struct platform_device *pdev)
|
||||||
.max_register = SZ_4K,
|
.max_register = SZ_4K,
|
||||||
};
|
};
|
||||||
struct device *dev = &pdev->dev;
|
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;
|
struct regmap *regmap;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pgc_np = of_get_child_by_name(dev->of_node, "pgc");
|
|
||||||
if (!pgc_np) {
|
if (!pgc_np) {
|
||||||
dev_err(dev, "No power domains specified in DT\n");
|
dev_err(dev, "No power domains specified in DT\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue