[PATCH] coresight: Drop the device node reference in of_get_coresight_platform_data

Wanhui Fu fuwh1120 at 163.com
Thu Nov 19 21:19:04 PST 2026


of_coresight_get_output_ports_node() acquires a device node reference,
but the reference is not dropped later. Use of_node_put() to do so.

Fixes: 5ecc7120194c ("coresight: Cleanup coresight DT bindings")
Signed-off-by: Wanhui Fu <fuwh1120 at 163.com>
---
 drivers/hwtracing/coresight/coresight-platform.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 6657a817719a..5d626b0f4e25 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -285,7 +285,7 @@ static int of_get_coresight_platform_data(struct device *dev,
 {
 	int ret = 0;
 	struct device_node *ep = NULL;
-	const struct device_node *parent = NULL;
+	struct device_node *parent = NULL;
 	bool legacy_binding = false;
 	struct device_node *node = dev->of_node;
 
@@ -303,7 +303,7 @@ static int of_get_coresight_platform_data(struct device *dev,
 		if (!of_graph_is_present(node))
 			return 0;
 		legacy_binding = true;
-		parent = node;
+		parent = of_node_get(node);
 		dev_warn_once(dev, "Uses obsolete Coresight DT bindings\n");
 	}
 
@@ -321,10 +321,12 @@ static int of_get_coresight_platform_data(struct device *dev,
 		ret = of_coresight_parse_endpoint(dev, ep, pdata);
 		if (ret) {
 			of_node_put(ep);
+			of_node_put(parent);
 			return ret;
 		}
 	}
 
+	of_node_put(parent);
 	return 0;
 }
 #else
-- 
2.25.1




More information about the linux-arm-kernel mailing list