From patchwork Mon Feb 28 11:08:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Koschel X-Patchwork-Id: 1598844 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=XoHp2vZs; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4K6fk51wv9z9sG1 for ; Mon, 28 Feb 2022 23:26:05 +1100 (AEDT) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4K6fk40km2z3btt for ; Mon, 28 Feb 2022 23:26:04 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=XoHp2vZs; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::630; helo=mail-ej1-x630.google.com; envelope-from=jakobkoschel@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=XoHp2vZs; dkim-atps=neutral Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4K6d1B0n8Sz30Dv; Mon, 28 Feb 2022 22:09:02 +1100 (AEDT) Received: by mail-ej1-x630.google.com with SMTP id r13so24005308ejd.5; Mon, 28 Feb 2022 03:09:02 -0800 (PST) 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=NwvvEiJPPM0SG7ZI4yc03tHRsjcGU4DYrm0+p7QW2+g=; b=XoHp2vZs5sXnnQm8jTsL06JwdjgH4Z1Am+qeboNHSyU/csHp7G8mKHTnYwT7vMJf3q 1zZobpdX4BxBQ2erAJx74EzSCDXfVaAB33jAX9ZekfWtpz9xLL4KIzz7DciQBlIBY9DK vi6LJyw6u5UaEjT8CWPzRGPwv8GzX6oWgjgvygChKW8zu7PwVtsUQz/kuHu5rW/3vaBt P3mcu2gbh7uG62xQrliOtXiVl+brL2WoHfh7VHyAXnwazE3NNCXTKdQujGPQMoLCoB+H 4TwL3ENhlSsI5tK0hgbUY+rfbxgFEyt/dohDr5V+g2PZ9mAGfyjh/75qZVaBOXbUEFp6 QPtA== 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=NwvvEiJPPM0SG7ZI4yc03tHRsjcGU4DYrm0+p7QW2+g=; b=INjQ09al8O2HArWjPwgjz7OEst8o/Y2hrFxesKhhvNh480X4i0Bp+ant2Al6NOMo04 R9BKorwD+LLBlq8YQJqa8CJOEuJXkblHFPZgFQftswDcrreMkL5sop+T3BoRxeuAa0x2 N98flMLob37mgqvNlquusTiGc+tgrS7PCZOv/eb48texwvH4/qfvuZbvidWF0ymKvq6w VijxZYsPI70xkg2YlrkODIiM+F32afFwSU25YrbkTiAOH3vPlHjxmPQ7wo3QRACnOF9G ZuWTy1YS3uuLRpYxBuGksdY+bBzk40k8hnsHyV78kwPQmJ9GSJo9r6H1mqvWqqEWlQ2X 3PeQ== X-Gm-Message-State: AOAM532JxHrseybp87W2lxDNbdM8ucsJt1WiNuSC2bIiG30Lp7S6/NX7 3BnHaICP8XEwLujPcEMQllw= X-Google-Smtp-Source: ABdhPJwx6JZK1Sd067eYUFaKDGIuHgaxlGXhzFGfLUQYCLtFq3NCzAqvSFrK3I6DGGTf6F+6FgXuew== X-Received: by 2002:a17:906:2608:b0:6c9:b248:4dcf with SMTP id h8-20020a170906260800b006c9b2484dcfmr14572317ejc.320.1646046539415; Mon, 28 Feb 2022 03:08:59 -0800 (PST) Received: from localhost.localdomain (dhcp-077-250-038-153.chello.nl. [77.250.38.153]) by smtp.googlemail.com with ESMTPSA id z22-20020a17090655d600b006d229436793sm4209049ejp.223.2022.02.28.03.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 03:08:59 -0800 (PST) From: Jakob Koschel To: Linus Torvalds Subject: [PATCH 4/6] drivers: remove unnecessary use of list iterator variable Date: Mon, 28 Feb 2022 12:08:20 +0100 Message-Id: <20220228110822.491923-5-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220228110822.491923-1-jakobkoschel@gmail.com> References: <20220228110822.491923-1-jakobkoschel@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 28 Feb 2022 23:23:25 +1100 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, linux-aspeed@lists.ozlabs.org, "Gustavo A. R. Silva" , linux-iio@vger.kernel.org, nouveau@lists.freedesktop.org, Rasmus Villemoes , dri-devel@lists.freedesktop.org, Cristiano Giuffrida , amd-gfx@lists.freedesktop.org, samba-technical@lists.samba.org, linux1394-devel@lists.sourceforge.net, drbd-dev@lists.linbit.com, linux-arch , linux-cifs@vger.kernel.org, kvm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-rdma@vger.kernel.org, linux-staging@lists.linux.dev, "Bos, H.J." , Jason Gunthorpe , intel-wired-lan@lists.osuosl.org, kgdb-bugreport@lists.sourceforge.net, bcm-kernel-feedback-list@broadcom.com, Dan Carpenter , linux-media@vger.kernel.org, Kees Cook , Arnd Bergman , linux-pm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Brian Johannesmeyer , Nathan Chancellor , linux-fsdevel@vger.kernel.org, Christophe JAILLET , Jakob Koschel , v9fs-developer@lists.sourceforge.net, linux-tegra@vger.kernel.org, Thomas Gleixner , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, linux-sgx@vger.kernel.org, linux-block@vger.kernel.org, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, tipc-discussion@lists.sourceforge.net, linux-crypto@vger.kernel.org, dmaengine@vger.kernel.org, linux-mediatek@lists.infradead.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, Mike Rapoport Errors-To: linuxppc-dev-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" When list_for_each_entry() completes the iteration over the whole list without breaking the loop, the iterator value will *always* be a bogus pointer computed based on the head element. To avoid type confusion use the actual list head directly instead of last iterator value. Signed-off-by: Jakob Koschel --- drivers/dma/dw-edma/dw-edma-core.c | 4 ++-- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 3 ++- drivers/net/wireless/ath/ath6kl/htc_mbox.c | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) -- 2.25.1 diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-edma-core.c index 468d1097a1ec..7883c4831857 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -136,7 +136,7 @@ static void dw_edma_free_burst(struct dw_edma_chunk *chunk) } /* Remove the list head */ - kfree(child); + kfree(chunk->burst); chunk->burst = NULL; } @@ -156,7 +156,7 @@ static void dw_edma_free_chunk(struct dw_edma_desc *desc) } /* Remove the list head */ - kfree(child); + kfree(desc->chunk); desc->chunk = NULL; } diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c index 091f36adbbe1..c0ea9dbc4ff6 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -3963,7 +3963,8 @@ static void __i40e_reprogram_flex_pit(struct i40e_pf *pf, * correctly, the hardware will disable flexible field parsing. */ if (!list_empty(flex_pit_list)) - last_offset = list_prev_entry(entry, list)->src_offset + 1; + last_offset = list_entry(flex_pit_list->prev, + struct i40e_flex_pit, list)->src_offset + 1; for (; i < 3; i++, last_offset++) { i40e_write_rx_ctl(&pf->hw, diff --git a/drivers/net/wireless/ath/ath6kl/htc_mbox.c b/drivers/net/wireless/ath/ath6kl/htc_mbox.c index e3874421c4c0..cf5b05860799 100644 --- a/drivers/net/wireless/ath/ath6kl/htc_mbox.c +++ b/drivers/net/wireless/ath/ath6kl/htc_mbox.c @@ -104,7 +104,7 @@ static void ath6kl_credit_init(struct ath6kl_htc_credit_info *cred_info, * it use list_for_each_entry_reverse to walk around the whole ep list. * Therefore assign this lowestpri_ep_dist after walk around the ep_list */ - cred_info->lowestpri_ep_dist = cur_ep_dist->list; + cred_info->lowestpri_ep_dist = *ep_list; WARN_ON(cred_info->cur_free_credits <= 0);