Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5612773imm; Tue, 12 Jun 2018 10:24:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKViAr+MULzP5d0yym5QXGxMrDXB990eFznm7D1n4Nwn0wx1PjytvFdZG3CPhP6ct0o6vhS X-Received: by 2002:a17:902:24c7:: with SMTP id l7-v6mr1413605plg.170.1528824256337; Tue, 12 Jun 2018 10:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528824256; cv=none; d=google.com; s=arc-20160816; b=o8KJWs1lh9oJaIF6yBuli1BQIUWHBmz38hJip5ikz/XenzMZozTgunVsan2iY4XLt0 4MTkzdYanohqfCo3jlYgPeOUafI/okvxdYbxQE/6CM/NFfHK1PpEAhWqdrXwrp9Y0y3c hLY0FtCPZBo77+VJLYx2BK7DVkDvJoRXT4D2h5xGFVFM7CCrMf6E/KQtagzqPxbM35b5 OcdJISWSxt8EnUq9m+3NvyUZEvn5yYGB2cz6Q++pUFunvdnpVxg3SMODXYkKRd3EnVRV 1j2je30QGsPntVVYb5qZbr7ftPeNo9vMCoWzc6xfv83XNQTx3H8BHzqpf0OEg2ukFo/f GmiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hcj41qS8aoTCaBhDCdw0FcjAjGQM/TF2CAZ/rCGhitw=; b=xkAAhlQ6NrNQDsVUwdcsmW3VjEk2W50EiYISFed8bdrhux+pInqWG0l8dPCtDtG8bg UO4lmbD9dduIJJSKQMorLhMVe0fsIWtclUFzPN0DV0KeGEoxM/jQMenf6WSTKFOyGKBv g6SXtG54thIipWxJ4Ze0iS6rxxtSVQDZJcONCLYAy3P80/s5l1ABFGQHMeMtvc+pM1zI koEOG/V2rYVOTSxHvy277x9AN1Kumnz9H4msXoDXJCK1KVlkH7kfxN3teQG7phzwUZEK /eQk1MHPNDm5kaUrtPkbtCi+zObh5jbs5RWmZjBc3gtOWF2uTZVdY8mge+L0K+mPzROf QlsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14-v6si589782pli.419.2018.06.12.10.24.01; Tue, 12 Jun 2018 10:24:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933857AbeFLRXi (ORCPT + 99 others); Tue, 12 Jun 2018 13:23:38 -0400 Received: from www.osadl.org ([62.245.132.105]:58252 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754257AbeFLRXf (ORCPT ); Tue, 12 Jun 2018 13:23:35 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w5CHMdrv021809; Tue, 12 Jun 2018 19:22:40 +0200 From: Nicholas Mc Guire To: Mauro Carvalho Chehab Cc: Maxime Coquelin , Alexandre Torgue , Hans Verkuil , Hugues Fruchet , Philipp Zabel , Niklas Soderlund , Benjamin Gaignard , "Gustavo A. R. Silva" , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH 1/2] media: stm32-dcmi: drop unnecessary while(1) loop Date: Tue, 12 Jun 2018 19:22:17 +0200 Message-Id: <1528824138-19089-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The while(1) is effectively useless as all possible paths within it return thus there is no way to loop. Signed-off-by: Nicholas Mc Guire --- This is not actually fixing any bug - the while(1){ } will not hurt here it is though simply unnecessary. Found during code review. The diff output is not very readable - essentially only the outer while(1){ } was removed. Patch was compile tested with: x86_64_defconfig, MEDIA_SUPPORT=y MEDIA_CAMERA_SUPPORT=y, V4L_PLATFORM_DRIVERS=y, OF=y, COMPILE_TEST=y CONFIG_VIDEO_STM32_DCMI=y (There are a number of sparse warnings - not related to the changes though) Patch is against 4.17.0 (localversion-next is next-20180608) drivers/media/platform/stm32/stm32-dcmi.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index 2e1933d..70b81d2 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -1605,23 +1605,21 @@ static int dcmi_graph_parse(struct stm32_dcmi *dcmi, struct device_node *node) struct device_node *ep = NULL; struct device_node *remote; - while (1) { - ep = of_graph_get_next_endpoint(node, ep); - if (!ep) - return -EINVAL; - - remote = of_graph_get_remote_port_parent(ep); - if (!remote) { - of_node_put(ep); - return -EINVAL; - } + ep = of_graph_get_next_endpoint(node, ep); + if (!ep) + return -EINVAL; - /* Remote node to connect */ - dcmi->entity.node = remote; - dcmi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE; - dcmi->entity.asd.match.fwnode = of_fwnode_handle(remote); - return 0; + remote = of_graph_get_remote_port_parent(ep); + if (!remote) { + of_node_put(ep); + return -EINVAL; } + + /* Remote node to connect */ + dcmi->entity.node = remote; + dcmi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE; + dcmi->entity.asd.match.fwnode = of_fwnode_handle(remote); + return 0; } static int dcmi_graph_init(struct stm32_dcmi *dcmi) -- 2.1.4