From patchwork Thu Apr 7 10:28:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Koschel X-Patchwork-Id: 12804985 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 5ADE1C433F5 for ; Thu, 7 Apr 2022 10:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244325AbiDGKdp (ORCPT ); Thu, 7 Apr 2022 06:33:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244306AbiDGKdf (ORCPT ); Thu, 7 Apr 2022 06:33:35 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FDFD9683B; Thu, 7 Apr 2022 03:31:12 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id dr20so9836184ejc.6; Thu, 07 Apr 2022 03:31:12 -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=JrLemglUST4WORuuuukktAwV8TRd9yLyGflAl3xl1zc=; b=WyOREzFfzYbYbcLeB8gc+wwbWojyzKQUgWjvo9Vn4QjrT1rTi9xtZRj0mVTe0B62ty JXFIP3trzcbd5i4YgUkTx/ltYxiagR4lJ0OPxM8UZ70oCHJ3U4M1q+1xgHFrD4bt5BJu TiKC7QXqW1sLc9HcMLxVP8ka1LRg94eK2McleovX+8TrXVbFOYUeSQzlauxOhKRfjWJY SixUHMJIRmnVW8P6LuIOSHzRLMIs+tg9L7Uhkoxg7cmhWDV8O0CSoOfNs+uej8UgHtCJ chVqhJAWIKvd/EeXFL4roipes4cs7ySm//Jj4r0+/WkZNwrPvwjJG4Uu0Wmn0GRG5ang ZOaQ== 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=JrLemglUST4WORuuuukktAwV8TRd9yLyGflAl3xl1zc=; b=nixL/rp3sXAAHunD2MsYG97KCxjpZzK8M1t/SZfZjsYfKL8Fe6vJHp3tPTFwoOwaSh JJcJBU6euaFszWbcB3tHb5dayIBnZB6Ot40wfh1VTevRWw1HCrEj8RMCb3hH8A5uT09B YihmG12Io0v3kLn6VVHAIVUJEsxwf3REiRgPnzFCvKkxxdTf1C5aO9EjTvoSvlfjMclx Y0Jpj4cF7cWfPmxALevfUQsidGNCAXZja5RHOos8MX+PpoAifPKajQYG0NS52tqfoB7V eicU4l1BlY1U9ZbNfW+cRBfANODdbBTyD4514Yz6s+9hx3zwj54laIdAm7rDJXiqPWuJ BK5A== X-Gm-Message-State: AOAM533EXScrhopYlpd9ohKhREjvTF/OhgAvNgE7WVDPFZuCRscpRhXV QsENrQskbdbb6HGK56nNeGU= X-Google-Smtp-Source: ABdhPJyewobKoIhkiW69eTX4QUvvE84+KI1RURJxm+/w8jCuoRNuw9RkuPi9ipd1CcAlGrc9cXUJ5A== X-Received: by 2002:a17:906:6a81:b0:6da:d7e5:4fa with SMTP id p1-20020a1709066a8100b006dad7e504famr12975794ejr.223.1649327471064; Thu, 07 Apr 2022 03:31:11 -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.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 03:31:10 -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 08/15] qed: Remove usage of list iterator variable after the loop Date: Thu, 7 Apr 2022 12:28:53 +0200 Message-Id: <20220407102900.3086255-9-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. Since "found" and "p_ent" need to be equal, "found" should be used consistently to limit the scope of "p_ent" to the list traversal in the future. Signed-off-by: Jakob Koschel --- drivers/net/ethernet/qlogic/qed/qed_spq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qed/qed_spq.c b/drivers/net/ethernet/qlogic/qed/qed_spq.c index d01b9245f811..cbaa2abed660 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_spq.c +++ b/drivers/net/ethernet/qlogic/qed/qed_spq.c @@ -934,10 +934,10 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, u8 fw_return_code, union event_ring_data *p_data) { + struct qed_spq_entry *found = NULL; struct qed_spq *p_spq; - struct qed_spq_entry *p_ent = NULL; + struct qed_spq_entry *p_ent; struct qed_spq_entry *tmp; - struct qed_spq_entry *found = NULL; if (!p_hwfn) return -EINVAL; @@ -980,7 +980,7 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, DP_VERBOSE(p_hwfn, QED_MSG_SPQ, "Complete EQE [echo %04x]: func %p cookie %p)\n", le16_to_cpu(echo), - p_ent->comp_cb.function, p_ent->comp_cb.cookie); + found->comp_cb.function, found->comp_cb.cookie); if (found->comp_cb.function) found->comp_cb.function(p_hwfn, found->comp_cb.cookie, p_data, fw_return_code);