[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220228110822.491923-5-jakobkoschel@gmail.com>
Date: Mon, 28 Feb 2022 12:08:20 +0100
From: Jakob Koschel <jakobkoschel@...il.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Jakob Koschel <jakobkoschel@...il.com>,
linux-arch <linux-arch@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Arnd Bergman <arnd@...db.de>,
"Andy Shevchenko" <andriy.shevchenko@...ux.intel.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Mike Rapoport <rppt@...nel.org>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
"Brian Johannesmeyer" <bjohannesmeyer@...il.com>,
Cristiano Giuffrida <c.giuffrida@...nl>,
"Bos, H.J." <h.j.bos@...nl>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Dan Carpenter <dan.carpenter@...cle.com>,
Jason Gunthorpe <jgg@...pe.ca>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Nathan Chancellor <nathan@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, linux-sgx@...r.kernel.org,
drbd-dev@...ts.linbit.com, linux-block@...r.kernel.org,
linux-iio@...r.kernel.org, linux-crypto@...r.kernel.org,
dmaengine@...r.kernel.org, linux1394-devel@...ts.sourceforge.net,
amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org, nouveau@...ts.freedesktop.org,
linux-rdma@...r.kernel.org, linux-media@...r.kernel.org,
intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
linux-wireless@...r.kernel.org, linux-pm@...r.kernel.org,
linux-scsi@...r.kernel.org, linux-staging@...ts.linux.dev,
linux-usb@...r.kernel.org, linux-aspeed@...ts.ozlabs.org,
bcm-kernel-feedback-list@...adcom.com, linux-tegra@...r.kernel.org,
linux-mediatek@...ts.infradead.org, kvm@...r.kernel.org,
linux-cifs@...r.kernel.org, samba-technical@...ts.samba.org,
linux-f2fs-devel@...ts.sourceforge.net,
linux-fsdevel@...r.kernel.org,
kgdb-bugreport@...ts.sourceforge.net,
v9fs-developer@...ts.sourceforge.net,
tipc-discussion@...ts.sourceforge.net, alsa-devel@...a-project.org
Subject: [PATCH 4/6] drivers: remove unnecessary use of list iterator variable
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 <jakobkoschel@...il.com>
---
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(-)
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);
--
2.25.1
Powered by blists - more mailing lists