Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd806f70 authored by Yadu MG's avatar Yadu MG
Browse files

coresight: Add ports and port child node check in get_ports function



In of_coresight_get_ports function, avoid unnecessary processing on
device node with no ports and port child nodes.

Change-Id: Ie9b212e512d93fd73b47e21db20ccc992c5779d8
Signed-off-by: default avatarYadu MG <ymg@codeaurora.org>
parent fcf83531
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
/* Copyright (c) 2012, 2017-2019 The Linux Foundation. All rights reserved.
/* Copyright (c) 2012, 2017-2020 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -57,6 +57,13 @@ static void of_coresight_get_ports(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);