[PATCH] bus: vexpress-config: Fix refcount leak in vexpress_syscfg_probe
From: Miaoqian Lin
Date: Thu Jun 02 2022 - 07:24:42 EST
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@xxxxxxxxx>
---
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