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 <jinlmao@codeaurora.org>
This commit is contained in:
Mao Jinlong 2020-05-04 22:16:50 +08:00 • committed by Gerrit - the friendly Code Review server
commit 7f20d186d0

View file

@ -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);