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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
Signed-off-by: Jyri Sarha <jsarha@xxxxxx>
---
 drivers/gpu/drm/tilcdc/tilcdc_external.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

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) {
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux