Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp59788lfe; Fri, 15 Apr 2022 19:28:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrvUZNu70ENyxMPEJrmNHl1tAhSnXyPNCuQrj8PPVi23xkRubnfIa+QjGGKh1OVx6jjDYG X-Received: by 2002:a17:903:285:b0:158:d693:c52c with SMTP id j5-20020a170903028500b00158d693c52cmr1836855plr.36.1650076106327; Fri, 15 Apr 2022 19:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650076106; cv=none; d=google.com; s=arc-20160816; b=uvNxqt0mupOAKRLQubg+pjrxSzz6fAQO8NO6EEWoKl0Tjm0NK5993mQoxStRS3jmYY mZ2XP3JUTbkb2ctxTOX9ZnwCkWz1GRdeROhenCS90TfU1mRQGiQu3mq/SCfWIr1ullgh drfqHeBxiqu58RA3JPNhf8Ogc0ToWsk8auh2z0utN+llgzxwTyUfdAICa1kCxP1/2Va6 2IapHGwKB4Nh6oDTDPCgvnlXS9F6UvN8Z31aEMvwugbXdA67T9rCr4rGxDjeq6DWUzSU g1HflomuLUJ1bqsrX4IfLJQUC4L66GGMJmsrFqI7ZMmPWOZJjbzDpIiKquXWNoZLkXoP 3uuw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0WZ3VKnVxGM80qdLHkweZkrBfRptzeVUXSKm7/OGDn8=; b=ioRTZdr1xXzBLMNO8simyQYpxgBwl1aF40PDmfTtEcjeHBp56iEEkrtlOtkExRDOlT 0SbVA9Pw9+fZG/czwwJgHkyiEEW1GMaYCy4m3NfcQm/IfB8O7bdgce589jJSxJ88GXd3 USEI1/cLewbuxA+jg+vY8pnCZZ2sOsXw9vVGFLhIQvelfILZFeiZjU3ZGnxGxLVyZ/dB h4r/sYOEMYr3++yl9/1UXLG1MNHsqrvgsjOQyEWZ2l4F4cqUPWdRUCIMuigCdii9Lo0x eau7Y0Je/c2SPg3LZpONfIXROQP3XNLlXKjwgKbyrkPQm8e2uUJ5vy5pJlwseimUXMBR fFeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HpKlEPRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d11-20020a056a00244b00b004fa7d166af8si3289701pfj.52.2022.04.15.19.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 19:28:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=HpKlEPRp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 245AC122233; Fri, 15 Apr 2022 18:40:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236180AbiDOMes (ORCPT + 99 others); Fri, 15 Apr 2022 08:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353873AbiDOMdc (ORCPT ); Fri, 15 Apr 2022 08:33:32 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14EA133E03; Fri, 15 Apr 2022 05:31:04 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id t25so9762689edt.9; Fri, 15 Apr 2022 05:31:04 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=0WZ3VKnVxGM80qdLHkweZkrBfRptzeVUXSKm7/OGDn8=; b=HpKlEPRptbD/f1jBswuHJ3tvWie+EvRLe0jlVv7fhDSfxhscO+VA6roZkgEC6/6ZDJ wjwgmhdS9bdvuRaYewcvaOMAsf0uZh+KFcQdXxRcE7NsGF5sGyFWYDL3rrc5XIK+0sSO YeNC4Ky18jsviNL6gUw7JnOE6cABTwUTyG7OJdPu+4KpKpcJ/KlP71IwKL4zNi2SLj60 h2MQmYdTvasp8jQDaGuzgrwE9rqpx6+DqAbk0uAyvaQ1v67IfmfBM/OUmgBmfluTvH0N OBl0XAO7QH6NSqt5pqsXAmGOEcTZ9cWxXP+bpDI62KX5XkzgQa4C4e2lxC2sBmFPQU1j tgOA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=0WZ3VKnVxGM80qdLHkweZkrBfRptzeVUXSKm7/OGDn8=; b=rvUmV2g0S3Cw5SfuiWBGYPiBRjtN5hcqps6Kj5FGsNdaNIQxb6Advywpl1lYeCruvW 3uAF71o/Ytv3Cf8S9bYZcufiZPg6o3cHPFAKy2cx1JIbcNSKjJlUDF5oKPrNRscaOKjp daPxawsbMqILu8BT0lzelx5kVSB1aXhykzl/9JEB4Q1VnFO1luD9OFh1B89Mo7W7OibG mRxW0Fpytalq9vd084l4+eiKT+WH07xCtwqPJ3ukdb6g56+jqUBj7rfssH/y/i/2hLel gODQFIP84YjLC6y9SAddTAuyYsBAGcIj+h0dv2tyETZnXRONme8byRVURIJwR8I3AnOf 4+Xg== X-Gm-Message-State: AOAM530jFYHXnwW3v51d405CRJW/l1+K+e3lHnlM2js8mvQypp8frGoA Djf/TU9AoAp20gM62yAk4Kw= X-Received: by 2002:a05:6402:430c:b0:419:4660:e261 with SMTP id m12-20020a056402430c00b004194660e261mr8010136edc.324.1650025862541; Fri, 15 Apr 2022 05:31:02 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id bo14-20020a170906d04e00b006ce98d9c3e3sm1649533ejb.194.2022.04.15.05.31.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 05:31:02 -0700 (PDT) From: Jakob Koschel To: "David S. Miller" Cc: Jakub Kicinski , Paolo Abeni , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Lars Povlsen , Steen Hegelund , UNGLinuxDriver@microchip.com, Ariel Elior , Manish Chopra , Edward Cree , Martin Habets , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Jiri Pirko , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Casper Andersson , Bjarni Jonasson , Jakob Koschel , Christophe JAILLET , Arnd Bergmann , Colin Ian King , Eric Dumazet , Xu Wang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, bpf@vger.kernel.org, Mike Rapoport , "Brian Johannesmeyer" , Cristiano Giuffrida , "Bos, H.J." Subject: [PATCH net-next v4 12/18] net: qede: Replace usage of found with dedicated list iterator variable Date: Fri, 15 Apr 2022 14:29:41 +0200 Message-Id: <20220415122947.2754662-13-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220415122947.2754662-1-jakobkoschel@gmail.com> References: <20220415122947.2754662-1-jakobkoschel@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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/ [1] Signed-off-by: Jakob Koschel --- drivers/net/ethernet/qlogic/qede/qede_rdma.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_rdma.c b/drivers/net/ethernet/qlogic/qede/qede_rdma.c index 6304514a6f2c..2eb03ffe2484 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_rdma.c +++ b/drivers/net/ethernet/qlogic/qede/qede_rdma.c @@ -246,18 +246,17 @@ static void qede_rdma_change_mtu(struct qede_dev *edev) static struct qede_rdma_event_work * qede_rdma_get_free_event_node(struct qede_dev *edev) { - struct qede_rdma_event_work *event_node = NULL; - bool found = false; + struct qede_rdma_event_work *event_node = NULL, *iter; - list_for_each_entry(event_node, &edev->rdma_info.rdma_event_list, + list_for_each_entry(iter, &edev->rdma_info.rdma_event_list, list) { - if (!work_pending(&event_node->work)) { - found = true; + if (!work_pending(&iter->work)) { + event_node = iter; break; } } - if (!found) { + if (!event_node) { event_node = kzalloc(sizeof(*event_node), GFP_ATOMIC); if (!event_node) { DP_NOTICE(edev, -- 2.25.1