All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: dri-devel@lists.freedesktop.org, airlied@linux.ie,
	linux-omap@vger.kernel.org
Cc: tomi.valkeinen@ti.com, Jyri Sarha <jsarha@ti.com>,
	dan.carpenter@oracle.com
Subject: [PATCH] drm/tilcdc: Fix bad if statement in tilcdc_get_external_components()
Date: Fri, 12 Jun 2015 12:24:33 +0300	[thread overview]
Message-ID: <1434101073-17677-1-git-send-email-jsarha@ti.com> (raw)

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 --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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

                 reply	other threads:[~2015-06-12  9:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1434101073-17677-1-git-send-email-jsarha@ti.com \
    --to=jsarha@ti.com \
    --cc=airlied@linux.ie \
    --cc=dan.carpenter@oracle.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.