From patchwork Fri Jun 12 09:24:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 6596431 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B56769F2F4 for ; Fri, 12 Jun 2015 09:24:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DDE5420654 for ; Fri, 12 Jun 2015 09:24:55 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0715D20652 for ; Fri, 12 Jun 2015 09:24:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48DFA6EA77; Fri, 12 Jun 2015 02:24:54 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by gabe.freedesktop.org (Postfix) with ESMTP id 98EBC6EA77 for ; Fri, 12 Jun 2015 02:24:52 -0700 (PDT) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t5C9OnL3018350; Fri, 12 Jun 2015 04:24:49 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t5C9Onne025768; Fri, 12 Jun 2015 04:24:49 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Fri, 12 Jun 2015 04:24:48 -0500 Received: from imryr.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t5C9Oli5032437; Fri, 12 Jun 2015 04:24:47 -0500 From: Jyri Sarha To: , , Subject: [PATCH] drm/tilcdc: Fix bad if statement in tilcdc_get_external_components() Date: Fri, 12 Jun 2015 12:24:33 +0300 Message-ID: <1434101073-17677-1-git-send-email-jsarha@ti.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Cc: tomi.valkeinen@ti.com, Jyri Sarha , dan.carpenter@oracle.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Jyri Sarha --- 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) {