From 7f20d186d06e0282f1d0bb5e8e23dc6b639501da Mon Sep 17 00:00:00 2001 From: Mao Jinlong Date: Mon, 4 May 2020 22:16:50 +0800 Subject: [PATCH] Add ports and port child node check in legacy function in get_ports_legacy function, if there is no ports and port child nodes of device node, just return to avoid unnecessary actions. Change-Id: Ie392f1fe8265cb3dba38ac687a0a1612e772a943 Signed-off-by: Mao Jinlong --- drivers/hwtracing/coresight/coresight-platform.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c index 4bf86f8d2004..71cafea607c4 100644 --- a/drivers/hwtracing/coresight/coresight-platform.c +++ b/drivers/hwtracing/coresight/coresight-platform.c @@ -68,6 +68,13 @@ static void of_coresight_get_ports_legacy(const struct device_node *node, { struct device_node *ep = NULL; int in = 0, out = 0; + struct device_node *ports = NULL, *port = NULL; + + ports = of_get_child_by_name(node, "ports"); + port = of_get_child_by_name(node, "port"); + + if (!ports && !port) + return; do { ep = of_graph_get_next_endpoint(node, ep);