Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp552484imm; Fri, 1 Jun 2018 05:49:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJEJypH6JGMJ5oyZK9E6/qLEhZXFMuBbPVU93Y/uhMlPv5X2Lj1rAcNCi7sXGihJdTnbIIz X-Received: by 2002:a63:2bc4:: with SMTP id r187-v6mr8788965pgr.231.1527857375866; Fri, 01 Jun 2018 05:49:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527857375; cv=none; d=google.com; s=arc-20160816; b=ZKBQHUPDe0NtVsenXz9pbO0DWhrZb1vMWtjSicPNxDvdoXHh1WIxg2LXsMcjxJLpBY SXrCw8Df8fKQSvSVFaE9wf5EYMl8G5uEOc4Z+tviSohv2V5IcPgySmeSZPs/ge+fwQ2Q 8vOYUyOhk72XxFIxs+PD7bhtSvj5Ipql5jlMppgNblleFQtjJWUARuUfoPjK4SVa/GPq +hVYQ18mhevMD7R+QQo5b6X5Cnv7QQGa79zC2ov77Lg+ZEByJ0bCfCCVigWl7akWlK1o vZV1zAfOpmJ+MnBrG2BpcUNGEzd3BiOiJrLDLFANVUGrLO0axlFNWpwOXyrlEP2qgfqh 4a7A== 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=9rOeHDJgxuwP2iz22T0CpeHWCfbCS3ddlj+goo8LHGo=; b=oFOY5atOQqjcQ1djF2Roc92v6Enr2qa5EeyjGReTgyoqZ1HmildqEX3tQia1ldYp30 /3ho5Sy6c+4Gml+vAqvt2UAFmWj9jraKEvWpc9DYCMUAmqVk0PqtubjtppRY7GJz/9Jd YWAXdmDeMRcB9J532mB7x7AwJMC4kunG67XOtkr/3rOlylLJO7Bnu2H2at8H0RYCz9FZ CIlkPHYijWNdoDpt72bw0ocO81wNh1694V68mzQFymrnW1yFDVxQJZxo7G/2wJbQt07G 3c6OX3JudhtBS3TcH3HGC6VAIDf7nii9ONICdZyxHESfgdG4Z6j6tZaHwOkjuBXRpyZo ledw== 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 t128-v6si31229205pgc.582.2018.06.01.05.49.19; Fri, 01 Jun 2018 05:49:35 -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 S1752001AbeFAMso (ORCPT + 99 others); Fri, 1 Jun 2018 08:48:44 -0400 Received: from 178.115.242.59.static.drei.at ([178.115.242.59]:53545 "EHLO mail.osadl.at" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751910AbeFAMsl (ORCPT ); Fri, 1 Jun 2018 08:48:41 -0400 Received: by mail.osadl.at (Postfix, from userid 1001) id 7E4785C0FE8; Fri, 1 Jun 2018 12:47:26 +0000 (UTC) From: Nicholas Mc Guire To: Ludovic Desroches Cc: Mauro Carvalho Chehab , Nicolas Ferre , Alexandre Belloni , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] media: atmel-isi: drop unnecessary while loop Date: Fri, 1 Jun 2018 12:46:14 +0000 Message-Id: <1527857174-24616-1-git-send-email-hofrat@opentech.at> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Mc Guire As there is no way this can loop it actually makes no sense to have a while(1){} around the body - all three possible paths end in a return statement. Signed-off-by: Nicholas Mc Guire Fixes: commit c1d82b895380 "[media] atmel-isi: move out of soc_camera to atmel" --- The diff output is unfortunately not that readable - essentially only the outer while(1){ } was removed. Patch was compile tested with: x86_64_defconfig + CONFIG_MEDIA_SUPPORT=y MEDIA_CAMERA_SUPPORT=y, CONFIG_MEDIA_CONTROLLER=y, V4L_PLATFORM_DRIVERS=y OF=y, CONFIG_COMPILE_TEST=y, CONFIG_VIDEO_ATMEL_ISI=y Compile testing atmel-isi.c shows some sparse warnings. Seems to be due to sizeof operator being applied to a union (not related to the function being changed though). Patch is against 4.17-rc7 (localversion-next is next-20180531) drivers/media/platform/atmel/atmel-isi.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/media/platform/atmel/atmel-isi.c b/drivers/media/platform/atmel/atmel-isi.c index e5be21a..85fc7b9 100644 --- a/drivers/media/platform/atmel/atmel-isi.c +++ b/drivers/media/platform/atmel/atmel-isi.c @@ -1106,23 +1106,21 @@ static int isi_graph_parse(struct atmel_isi *isi, 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 */ - isi->entity.node = remote; - isi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE; - isi->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 */ + isi->entity.node = remote; + isi->entity.asd.match_type = V4L2_ASYNC_MATCH_FWNODE; + isi->entity.asd.match.fwnode = of_fwnode_handle(remote); + return 0; } static int isi_graph_init(struct atmel_isi *isi) -- 2.1.4