Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp411457pxb; Thu, 7 Apr 2022 08:45:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyS72Wsi0p84cJ1U2G5mvmG45K3m5wdnZ0WIgA+Ny16RQJaJt3jV7vqDosXozt0tWh34HZG X-Received: by 2002:a05:6402:50d0:b0:419:7df9:55c8 with SMTP id h16-20020a05640250d000b004197df955c8mr14615203edb.79.1649346325852; Thu, 07 Apr 2022 08:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649346325; cv=none; d=google.com; s=arc-20160816; b=HOVTFMU9/+yk9IdOGHK5abpPuNpAAN1H3+J+4lH4U3CCRQufWdm9a8o9pR2xyqmLqd j3B34RVRqTioi5YycbeznKA5VVThpuvACJ5lN7jSabw69h9SdQ+4g4M8jd+Ya0zB01ct hMfdPfWaffMPMkhWKLtGCan5SWCvgH6r0yPQjc1I/nWmvWw0v8VD/Y4xgs1GcqeRlNFq op3yfF6d8Sxu168CYfRaoudD0cKHBR2k9OYI5MeJRqdgby9wKLrR/QBJcn7A4tYi81Ya qxOUXxYCCnL419Ko2BRgOo7cDZ8WjJEpKRdmmGbXwFZDCntmTWlXMga45lP7lKzCxrUR 9W3w== 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=ZwoYZwnl8qg+KVK0eh/g1SUG+5e5Wb8xc6btnhlvctu+hNY65i6jg0jLlcEW1Nj/FM rz835kCwffTIBSMlP/ztWPeyik/NDt6d2KEwL/SZ0sy4DG87GD3Ri9iek/eBirndMgLy EMAZf8WrCaL2YnkRJTZ5iMy5dM26nmMJy43eZvmHF3XMocHeI3IGbcVpMT6SjiKuIXXo BxKsl1GJlfrwX2682B00zlUouho/iDVHaTfozsPCoNA5ARmFv+8zN+7MLvHM0YYHuX5w 7vn7M8cSNpOEzPhHC1FCnFO4Z2h2NCSlEJ6gnWwF+57I2vPCiSqu0GOLJyQMnnBVPkLu NePg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=psXxvtKp; 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 h6-20020a50cf86000000b0041978294066si13756193edk.275.2022.04.07.08.44.37; Thu, 07 Apr 2022 08:45:25 -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=psXxvtKp; 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 S244366AbiDGKdu (ORCPT + 99 others); Thu, 7 Apr 2022 06:33:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244308AbiDGKdf (ORCPT ); Thu, 7 Apr 2022 06:33:35 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3227A0BD3; Thu, 7 Apr 2022 03:31:13 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id r13so9909083ejd.5; Thu, 07 Apr 2022 03:31:13 -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=psXxvtKpLTnF15fGTW9J2WvLZlujjvqliLevcxrCSiYtKjZtJTfeEpXzWJf4fOHkt7 sz+q9Kly+6hflNlePYdjnPmbVZEJA6fYllxoHfTV322z/QaHXxSFSXTjegMbBVXRoCXW ZiBeSs63LffEeItrhpvdjJk6SCNZ6YH2h269ME5gBvLIgUrmFuobORberbv74W+9V4ll 1fb67F0wXJo/CJeUB0br/hOiunxZvG71XRidsn6qpAIT9Uq1MDL3J7laXyX0faDXRs3U 7dmXgf5chKtWtyEbyzRge02jFU4gh4aBzvq9mZ0eame6sv1swkM4NQXPlWWizedfINPY DHWw== 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=ww0D1c5st71QpaEyqCR4Z8AEUxmwBx0YmeFU9gAuE+a4RjqBblqCX9+Znf+NmbkBIv dij8jaQDr/e+5ZugKYotak/UYqv+y4T4f/BInSw8vItpZyMc4D/qvDoo/DPH7ETW8HYi Jx9M0QUx1QkAlRHqbtfauWE/JUx3IhegfCHG2jiq/jmQSqVViuYAS7Cs16l1RoSVO8j9 W5TsBnj248fwBm+nFTiRL1iRLwlvHRpRM3it4h99bFQqteC7Q24+qkyOiXSzfTa03h8n oerjHj5PVxFx2pZVWQnMtWy1lV9XG5FrEMB6kvAOtaWuT4P03WujLAMU2NCTFM1ojuSs WCmg== X-Gm-Message-State: AOAM531HhQFYU0H8GPvbbD2GYacgvtOahBeNm0ppno8QQ7jbIoa7La51 xhHnVNC4JtjKNvr6HSb1Dnk= X-Received: by 2002:a17:907:3c81:b0:6e6:9387:3d74 with SMTP id gl1-20020a1709073c8100b006e693873d74mr12716516ejc.589.1649327472360; Thu, 07 Apr 2022 03:31:12 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id c5-20020a170906d18500b006ce371f09d4sm7413573ejz.57.2022.04.07.03.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 03:31:11 -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 , Casper Andersson , Bjarni Jonasson , Jakob Koschel , Colin Ian King , Michael Walle , Christophe JAILLET , Arnd Bergmann , Eric Dumazet , Di Zhu , Xu Wang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Mike Rapoport , "Brian Johannesmeyer" , Cristiano Giuffrida , "Bos, H.J." Subject: [PATCH net-next 09/15] net: qede: Replace usage of found with dedicated list iterator variable Date: Thu, 7 Apr 2022 12:28:54 +0200 Message-Id: <20220407102900.3086255-10-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220407102900.3086255-1-jakobkoschel@gmail.com> References: <20220407102900.3086255-1-jakobkoschel@gmail.com> 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/ [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