diff mbox

drm/tilcdc: Fix bad if statement in tilcdc_get_external_components()

Message ID 1434101073-17677-1-git-send-email-jsarha@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jyri Sarha June 12, 2015, 9:24 a.m. UTC
The if statement condition should have been "!node ||
!of_device_is_available(node)" (&& changed to ||), but let's rewrite
the whole inside of the loop for better readability.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_external.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
index 03acb4f..a641808 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
@@ -142,19 +142,16 @@  int tilcdc_get_external_components(struct device *dev,
 	int count = 0;
 
 	while ((ep = of_graph_get_next_endpoint(dev->of_node, ep))) {
-		struct device_node *node;
-
-		node = of_graph_get_remote_port_parent(ep);
-		if (!node && !of_device_is_available(node)) {
-			of_node_put(node);
-			continue;
+		struct device_node *node = of_graph_get_remote_port_parent(ep);
+
+		if (node && of_device_is_available(node)) {
+			dev_dbg(dev, "Subdevice node '%s' found\n", node->name);
+			if (match)
+				component_match_add(dev, match, dev_match_of,
+						    node);
+			count++;
 		}
-
-		dev_dbg(dev, "Subdevice node '%s' found\n", node->name);
-		if (match)
-			component_match_add(dev, match, dev_match_of, node);
 		of_node_put(node);
-		count++;
 	}
 
 	if (count > 1) {