[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220602112428.3002-1-linmq006@gmail.com>
Date: Thu, 2 Jun 2022 15:24:26 +0400
From: Miaoqian Lin <linmq006@...il.com>
To: Liviu Dudau <liviu.dudau@....com>,
Sudeep Holla <sudeep.holla@....com>,
Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
Miaoqian Lin <linmq006@...il.com>,
Rob Herring <robh@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: [PATCH] bus: vexpress-config: Fix refcount leak in vexpress_syscfg_probe
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.
Fixes: a5a38765ac79 ("bus: vexpress-config: simplify config bus probing")
Signed-off-by: Miaoqian Lin <linmq006@...il.com>
---
drivers/bus/vexpress-config.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/vexpress-config.c b/drivers/bus/vexpress-config.c
index a58ac0c8e282..b368e2f01f8b 100644
--- a/drivers/bus/vexpress-config.c
+++ b/drivers/bus/vexpress-config.c
@@ -395,10 +395,13 @@ static int vexpress_syscfg_probe(struct platform_device *pdev)
struct device_node *bridge_np;
bridge_np = of_parse_phandle(node, "arm,vexpress,config-bridge", 0);
- if (bridge_np != pdev->dev.parent->of_node)
+ if (bridge_np != pdev->dev.parent->of_node) {
+ of_node_put(bridge_np);
continue;
+ }
of_platform_populate(node, NULL, NULL, &pdev->dev);
+ of_node_put(bridge_np);
}
return 0;
--
2.25.1
Powered by blists - more mailing lists