Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp64103pxh; Thu, 7 Apr 2022 14:05:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzphzECDbvFSbYPBMEjT6oHX2sdWspZKOVjRRqY3tgR2bOXOuTKg+odxUoA2G0N5JOjAb2g X-Received: by 2002:a05:6a00:1897:b0:505:6e58:4a2c with SMTP id x23-20020a056a00189700b005056e584a2cmr3425030pfh.2.1649365515988; Thu, 07 Apr 2022 14:05:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649365515; cv=none; d=google.com; s=arc-20160816; b=F64Hxwhcwp+w3y7mF9YKvS18SsDjM33WnYc7L1VRkeyQS/WY5UcY/SWX+xx+ogmPbf uPbQJNQIE9NfWu92VHrFF1JbbTQQ73qxKHKeCy/cY8mUXEzzBJhWqyWyI/OeaWFbCokM pgy9S9Z5Xdd4elXsBtm1+DyXtXQoaE+3nIITaiG2QXn54AiAsRsyrGdJ7hdFyBio9ETe Pw3KMHSsnothEsyDIL/HSrCyjUH2QgRlWrH2zkzdrjRiPYODKTA2BYyjT1Zy695CH54u FcUTuHYUwyriiHV6MsFNXMGRazo4n800hKFkC6ZHfuHYOH9WFgPOalmgEpfUDTVZRvzg ernw== 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=f1NofSwJuKbiTcVP4Eyds36Vn/5/VoS2zfBkRtVaGBU=; b=arRZJ/qsNF2MkVDz8lblkERbBHPwhbNFMb+wGB0VxPNvXE7bxKdVGlGAE6GJU16YmI PmpkYqeFQtUmIe/pFQjMI2As8JibhejhBE1pLZU1Int84P4YSRP15XY2S6rSZNtHifo2 5SCoPTrD26PkExh6QkLDMWsGgHiOAnK9SLde8RIIHGEmWvtL21QYpJaSmywhks45al2E Z6ynFJWkzQ0LqkT4MgqisUt8QXgXlX67AeWzRB5r8UIaSJ62Funuf+hC3KkCUw3iTO2g tezTKHfHjl1nv5g/yFcsDLAMp5ZSloBMr01YO6soLaGDhz4lJBNg73NhgshvmYotn2KS +LYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mPVBrjND; 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 q19-20020a170902b11300b00156fdfa2003si623151plr.473.2022.04.07.14.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 14:05:15 -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=mPVBrjND; 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 D62064781C2; Thu, 7 Apr 2022 13:10:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244420AbiDGKeM (ORCPT + 99 others); Thu, 7 Apr 2022 06:34:12 -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-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 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 [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; } -- 2.25.1