Received: by 2002:a05:6a10:3150:0:0:0:0 with SMTP id m16csp3145956pxc; Tue, 12 Apr 2022 14:52:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxcQ8RVCxA68oNXu8cvEDoABTl0MFHjYJQhRJT3Q6auQI4efjiEjJDz0yzFVFswyRew6aG X-Received: by 2002:a65:6a13:0:b0:373:14f6:5d33 with SMTP id m19-20020a656a13000000b0037314f65d33mr33461452pgu.62.1649800367226; Tue, 12 Apr 2022 14:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649800367; cv=none; d=google.com; s=arc-20160816; b=ITzyhEutyaId7yAl7Y7JpEemaeHnCR2OMJVzs4UNzKGXB9E3P30QBP+TaEF1GrAuCC /qWK227jnM1jIboRvYoHfjqKE91EmZX+NzNow5qVXmfyMkUCJ+YSVNG/+Jaedfd1Klcd fFoYd/a/z1/50UgfSZvfpBry14JIkMSPG/7gA3csR4F0cAJKEY5Gsxnm7PbCejDoCyde pZDtj42Szm/MkLtIzo6d8o/DQwUm7l+6Gs839jfvgpsQK+IaXaODKFxRW4WnEfi52+I+ kch6qbmZf5OF/wt4bPVTEZoyrBmP7GVsCapMAvdSQHTo/izsmukanZAXZH/rlYXF1TR3 41BA== 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=kM3YhnzhiKYrIOXpfyjuiE9Djz0oW6oQ+NEencdxdlB6Xtuo1/quqXDj73uZLDMY+3 sQLRfYrfY3gdICW3wN+WzghVCiAhNuym5DnkYM7M9AGvEWMAFP984ekeV7AhCqcOQ6Yx FRqv9etVWjbbqW1kDW5L4hyWEY4mSoiGPXcL5rT2tw50KnN92C4vtG7ICGSrPsrd3fQ8 MD4a6seBg3AuwzpoP9J78P8LilS9BRcm+f+kmnDZcOjkREiAFMeNjhkPXgCYl9FtOD/N 4rEIG+SPu/00j+meqSCLyb0SIZgKc5DPT0MlBsuXSDGGhz64lJq7edFTiSGLET617a/k aBxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=n6T5ecYV; 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 a123-20020a636681000000b0039d3228a8c6si3682574pgc.73.2022.04.12.14.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:52:47 -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=n6T5ecYV; 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 8BBF215CB40; Tue, 12 Apr 2022 13:54:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349213AbiDLMFs (ORCPT + 99 others); Tue, 12 Apr 2022 08:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351671AbiDLMCl (ORCPT ); Tue, 12 Apr 2022 08:02:41 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 210477C177; Tue, 12 Apr 2022 03:59:05 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id d10so21936953edj.0; Tue, 12 Apr 2022 03:59: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=f1NofSwJuKbiTcVP4Eyds36Vn/5/VoS2zfBkRtVaGBU=; b=n6T5ecYV25fQHGfNg04fPw61yjwu7JDQTTNAYkQ9iq76fS3t1EFlg4sEVWOWrgqA3N Zceu32aAeOl7lmZEF/zjOCTE75lPxENShcxrpfYwRJXIHaHVnHM1lCTPnfJCN46vsUUe nG20IXu/k/W3ICvqeVxPzFk3d8lv4FGYLL8Tr/zkoUvJg4WJETkI1UkSsLd+fnXVzRvI 8R2xZUQaIi/w6R+HTmBxRMLz6u27TwDrxxKDOooluwuS98grOg3n+JAKITo9k96Ahsjs 6c4HqqS5TBco+rhmH2+9IlttsCuhYjKUmyvCQvA3sB6GJ7eB23jrxVHWfE/ilIHopviP KEIw== 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=TLkk6hI8qQS0iUV4j6kFkz/gC5NRHxBph2wKw/GcjwKdFIU7zCHHJh7qTs2QmtgJYq o5rhCowf87DuuDKMD5cKt1kUT2quQ2D/pgl2+roaMoQPHp/J/es+fqyAjYswQJuKTQLJ ppvDHcHrzjjl4Rn6E0Pftsx51dFJtbuiMFd4gq0CRwxS2mVXtwkyarUH/Vy8hLIN10B4 fpgvJzmuYGRlpfD7A6EMMFXuHvLcwueRcahtNr8Jo4M3gi767zHKe6Eq/EPyl23in49D j1msvbVgFJGbrYEcHgAwaepfjO3mw2cfTzyAfr7l9LNu3yKtoZEg1DhHyy9+hZkJSSNs lfDQ== X-Gm-Message-State: AOAM532z7VhAGkiStiy2BFQ4rEcHfvu5j6yAaknWG3doxef1Z/U/VO9z n2TJMU83jNBYSc54YmWh8/g= X-Received: by 2002:a05:6402:2945:b0:41d:aad:c824 with SMTP id ed5-20020a056402294500b0041d0aadc824mr26102204edb.364.1649761143563; Tue, 12 Apr 2022 03:59:03 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id f1-20020a056402194100b00416b174987asm16986370edz.35.2022.04.12.03.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 03:59:03 -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 , Jakob Koschel , Colin Ian King , Arnd Bergmann , Michael Walle , Christophe JAILLET , 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 v2 09/18] qed: Use dedicated list iterator variable Date: Tue, 12 Apr 2022 12:58:21 +0200 Message-Id: <20220412105830.3495846-10-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220412105830.3495846-1-jakobkoschel@gmail.com> References: <20220412105830.3495846-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