From patchwork Thu Apr 7 10:28:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Koschel X-Patchwork-Id: 12804984 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDB95C43217 for ; Thu, 7 Apr 2022 10:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244362AbiDGKdm (ORCPT ); Thu, 7 Apr 2022 06:33:42 -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-Google-Smtp-Source: ABdhPJwXhF62+KQx2qRWjcGwur8LcVxWXz0H04w+eZoOMrQen+VAHPSnEoKcFI7yJhQx8Y/gpS5Atw== 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@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,