Skip to contentSkip to conversation

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

PATCH New Jyri Sarha 1 participant 1 message Jun 12, 2015

Subsystems (3)
lore
Share & tools
lore

Jyri Sarha

author
#0 lore raw

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

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.

---
 drivers/gpu/drm/tilcdc/tilcdc_external.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/gpu/drm/tilcdc/tilcdc_external.c +8 -11
index 03acb4f..a641808 100644
@@ -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) {
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel