From patchwork Thu Apr 7 10:28:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Koschel X-Patchwork-Id: 12804987 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 32205C433F5 for ; Thu, 7 Apr 2022 10:31:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244394AbiDGKdt (ORCPT ); Thu, 7 Apr 2022 06:33:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244292AbiDGKdO (ORCPT ); Thu, 7 Apr 2022 06:33:14 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1730383B14; Thu, 7 Apr 2022 03:31:09 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id x24so891331edl.2; Thu, 07 Apr 2022 03:31:09 -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=f1NofSwJuKbiTcVP4Eyds36Vn/5/VoS2zfBkRtVaGBU=; b=mPVBrjNDRSKFnXBMjokClolP1gEqY1f/xNBXpmGUphbGpB86gSOCxQ36CB3FM/eiSJ wS6Oq6p6OOEp2onWQFVvJfzHdDVgU5bhd0XCuop5GfAiPYRGakMDZECfd+gruNOQC1Ge PxxACeDIhJvtKRA5qdzwIpJlPWLC0H5MfHABv80edUIN+HSDRJfOwMzzCqgZvCnYSelJ xRQdIckbsBzYUjsESqCIR7w5Q9oT+83Xgd0J+1FEZ2pj0LeKzxs/lR2wx9wVfizJCkbB VUvsxW7NV6nZ4ER1ZxSao5e/dZhFrAZTVjRRP5Gv4ON3wQrlZ6XfoyO4+bnzr9NNzzOX DSoA== 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=f1NofSwJuKbiTcVP4Eyds36Vn/5/VoS2zfBkRtVaGBU=; b=bE36+upsQFsAh0I6Tx6/kLtC5jf/Tb3qSmoWgnbmTMq261CmVA/mK1MsMiYlyrHCq6 saZxMyi5zIXISMLuh4JN4P6A7cPBwg+Z3Nz8ZGuM7un1lChG2MRaYIy/Cb05lnkDe5iG 3SOZ1zhjj5IEUUBqfJgsfbxd3b6hHpVeYNTgF2M2LkIWvcOJM8UOFLJbe7n9jRGNAB0T j9eTEfD4C9wG7lxwzaKttnNb8U56DX/8gY7RpkEc8yWD6sG3SgaMhp9C58+jNYMWjZlZ rz4tbTNbHWf0WxwoyDbDgL6zGqLKXr9yNQppF//3rdC7esiDRhmNh7yUTAiauBu0hP4J he7A== X-Gm-Message-State: AOAM533vUb/lWj8i/iz6BOluONsOB7ywU8CrOR3GHPbJ/HbCyZXDVjr7 3XkxZgHZsUrwOqwl5rsdw2Y= X-Google-Smtp-Source: ABdhPJxhyOLOUaA05vo+Xl63Y34SMUPml4tHedyJPbBGpSZT1vRmx0YR+uDsfyLsMnlqwc+LyQPpyw== X-Received: by 2002:a05:6402:350d:b0:419:547f:134a with SMTP id b13-20020a056402350d00b00419547f134amr13733726edd.405.1649327468259; Thu, 07 Apr 2022 03:31:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 03:31:07 -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 06/15] qed: Use dedicated list iterator variable Date: Thu, 7 Apr 2022 12:28:51 +0200 Message-Id: <20220407102900.3086255-7-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 [1]. 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/qed/qed_dev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c index 672480c9d195..e920e7dcf66a 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_dev.c +++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c @@ -174,7 +174,7 @@ int qed_db_recovery_add(struct qed_dev *cdev, int qed_db_recovery_del(struct qed_dev *cdev, void __iomem *db_addr, void *db_data) { - struct qed_db_recovery_entry *db_entry = NULL; + struct qed_db_recovery_entry *db_entry = NULL, *iter; struct qed_hwfn *p_hwfn; int rc = -EINVAL; @@ -190,12 +190,13 @@ int qed_db_recovery_del(struct qed_dev *cdev, /* Protect the list */ spin_lock_bh(&p_hwfn->db_recovery_info.lock); - list_for_each_entry(db_entry, + list_for_each_entry(iter, &p_hwfn->db_recovery_info.list, list_entry) { /* search according to db_data addr since db_addr is not unique (roce) */ - if (db_entry->db_data == db_data) { - qed_db_recovery_dp_entry(p_hwfn, db_entry, "Deleting"); - list_del(&db_entry->list_entry); + if (iter->db_data == db_data) { + qed_db_recovery_dp_entry(p_hwfn, iter, "Deleting"); + list_del(&iter->list_entry); + db_entry = iter; rc = 0; break; }