Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1936189pxb; Fri, 25 Mar 2022 08:14:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgdjus9oyuDRKfcZb7D4tOxne+CLVwzqiNwd0Cw1MWJxoW6x/wDoKiMXZUSmNhOHUhI3oK X-Received: by 2002:a17:906:6a19:b0:6e0:aa9a:dbc8 with SMTP id qw25-20020a1709066a1900b006e0aa9adbc8mr3089819ejc.15.1648221248097; Fri, 25 Mar 2022 08:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648221248; cv=none; d=google.com; s=arc-20160816; b=sF8G7bY5TgYoChl2c/ieL6E35r0IUg0fNBqOVEtiQLpnpIdgy4QDGmru2zgST8Sp/8 L3uo4aJ2kSrcmPyAIebXOuNkDpxGjNyIEEfHZ7wLHWNFm0CMKjJlx+OelIHQpBKX8I0L Pxr3quuqa4TcWol2Dwbq68Dm5aV2XuKTkVj0eEXXDb3f5ZwRrUA9LxjDdX89M+G22x3n DXa9ZWMg8wnb40SroybaUnfYhI+1uqoVmjIJRMgKAbDFvwSdk4HxIboYebexU9dO7GRb cl4qfGLJ9Bvmgds3blZBcNHKA+95Y6ztHR0klnSHGMiqiZn+twtW2uJnSxQilHJ3oKmc DmOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=EwHGNo4299brXkfx15j4GX5scza9emTqyVtoZOQKDeg=; b=F5qssRq1cMJ7wTeORiWycOxOEB2Yxoim4+5Zv9kO0MdCrUUlB7LLBSbrirtrEN85TJ 8QAVgB0eEvrtHP2Ould0pxMGYZLQgW4oTdpFGgwtklNxg3bwEgWqwzjLyHkyricIQYpf njnXX1sDpZ7lGs7VfsFzlxussdMH6WcNV1dNBeI2++3oF9DAIsbXHn//1J7HiSIz3rH6 cmgfVh7BIcPVacGlrqnURas/IjQzYZiw6CxxR6p3G8Kld1YBQxKV1T4ylFmqSUUY/CDU L1NYr0dSltWh7Vse/uZbL5OobF+a2aQ1EtBvqviKnSrh5N9HnNT+XC76BqtmBybnkF6n U0IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mUjGObUl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p6-20020a17090635c600b006df76385cbfsi2637811ejb.351.2022.03.25.08.13.42; Fri, 25 Mar 2022 08:14:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mUjGObUl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348372AbiCXHMO (ORCPT + 99 others); Thu, 24 Mar 2022 03:12:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241560AbiCXHML (ORCPT ); Thu, 24 Mar 2022 03:12:11 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A3C992858; Thu, 24 Mar 2022 00:10:40 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id bg10so7282552ejb.4; Thu, 24 Mar 2022 00:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EwHGNo4299brXkfx15j4GX5scza9emTqyVtoZOQKDeg=; b=mUjGObUl7C0bY7nCN6SUhdA9Uke/I0GKeZg30Rjqz7+hQfShrg2m5LPgKfjJnZcWh+ 2uLPDy+zPbyuNNIq24rohLVJfWV59EKAZpW19QlacMWFQQz2m0uiBzaUZbT/+30B84Oi yzaYAE56uZH1G+iRM/rRAO86SUv4q9rXf3mFMKYSAhSE7a6Lfpylcl/6XBnUc06CjQzW WB/mVyATDETVDO3jOo2FIvR0V2/jZoKkEwPbdBkjPZnc0YL98v9fbjgrRargUvUfzbli fDLpBtnATbFwkx/A5ixyeVagHX+E8n+e+/Kd4YNU2OJ8jGMMjUI7Q0rAkRzcu95htbH3 Gj8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=EwHGNo4299brXkfx15j4GX5scza9emTqyVtoZOQKDeg=; b=ah+2BI2LwDr3wsAJ9V+fYTV6FrEzbCb/xdugMflCXGZrMpRm1z/T7Fo0s8uP/eF2E+ d87h2g166fBC7SP1BAid7DTjmA8Kc5Mx80vNFaei8TApYzpB2CWG3GQez8/L8yfJxULP S6uNOcu/GWqC+Na1wo9ZJFPo4vBSmlRreXFzaayvQKmb6Vk2kKJPEplVmb6h7NsADFvV MFpuTxZV02dhyswD4rsQoSrZPn6lf5asmrQE0dw6rUby6dsBPgYaiXwsjdCQunMhOM5g i/eHBDKgPHGP1s6A+YBaVhsuFUvcevhWrh6wandLZ6+SY5qhnuQtOFPo7ub8FkRfTCh+ WANQ== X-Gm-Message-State: AOAM531+x5dghTbfejhftv8zTsganwzrv4xVSyi4onDo0tEBBAV14neJ BleTXzsH47/JOoodFqscOAc= X-Received: by 2002:a17:907:60c8:b0:6da:83f0:9eaa with SMTP id hv8-20020a17090760c800b006da83f09eaamr4081185ejc.605.1648105838649; Thu, 24 Mar 2022 00:10:38 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id b7-20020a170906490700b006b2512921b2sm766465ejq.48.2022.03.24.00.10.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Mar 2022 00:10:38 -0700 (PDT) From: Jakob Koschel To: Tero Kristo Cc: Michael Turquette , Stephen Boyd , linux-omap@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport , "Brian Johannesmeyer" , Cristiano Giuffrida , "Bos, H.J." , Jakob Koschel Subject: [PATCH] clk: ti: clkctrl: replace usage of found with dedicated list iterator variable Date: Thu, 24 Mar 2022 08:10:19 +0100 Message-Id: <20220324071019.59483-1-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable instead of a found boolean [1]. This removes the need to use a found variable and simply checking if the variable was set, can determine if the break/goto was hit. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ Signed-off-by: Jakob Koschel --- drivers/clk/ti/clkctrl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c index 864c484bde1b..f12caef4f9bd 100644 --- a/drivers/clk/ti/clkctrl.c +++ b/drivers/clk/ti/clkctrl.c @@ -232,8 +232,7 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, void *data) { struct omap_clkctrl_provider *provider = data; - struct omap_clkctrl_clk *entry; - bool found = false; + struct omap_clkctrl_clk *entry = NULL, *iter; if (clkspec->args_count != 2) return ERR_PTR(-EINVAL); @@ -241,15 +240,15 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, pr_debug("%s: looking for %x:%x\n", __func__, clkspec->args[0], clkspec->args[1]); - list_for_each_entry(entry, &provider->clocks, node) { - if (entry->reg_offset == clkspec->args[0] && - entry->bit_offset == clkspec->args[1]) { - found = true; + list_for_each_entry(iter, &provider->clocks, node) { + if (iter->reg_offset == clkspec->args[0] && + iter->bit_offset == clkspec->args[1]) { + entry = iter; break; } } - if (!found) + if (!entry) return ERR_PTR(-EINVAL); return entry->clk; base-commit: f443e374ae131c168a065ea1748feac6b2e76613 -- 2.25.1