[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220324071607.60976-1-jakobkoschel@gmail.com>
Date: Thu, 24 Mar 2022 08:16:07 +0100
From: Jakob Koschel <jakobkoschel@...il.com>
To: Sunil Goutham <sgoutham@...vell.com>
Cc: Geetha sowjanya <gakula@...vell.com>,
Subbaraya Sundeep <sbhatta@...vell.com>,
hariprasad <hkelam@...vell.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Mike Rapoport <rppt@...nel.org>,
"Brian Johannesmeyer" <bjohannesmeyer@...il.com>,
Cristiano Giuffrida <c.giuffrida@...nl>,
"Bos, H.J." <h.j.bos@...nl>, Jakob Koschel <jakobkoschel@...il.com>
Subject: [PATCH] octeontx2-pf: replace usage of found with dedicated list iterator variable
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 instead of a
found boolean [1].
This removes the need to use a found variable and simply checking if
the variable was set, can determine if the break/goto was hit.
Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/
Signed-off-by: Jakob Koschel <jakobkoschel@...il.com>
---
.../net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
index 77a13fb555fb..e47a7588f6d3 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
@@ -1115,9 +1115,8 @@ static int otx2_remove_flow_msg(struct otx2_nic *pfvf, u16 entry, bool all)
static void otx2_update_rem_pfmac(struct otx2_nic *pfvf, int req)
{
- struct otx2_flow *iter;
+ struct otx2_flow *flow = NULL, *iter;
struct ethhdr *eth_hdr;
- bool found = false;
list_for_each_entry(iter, &pfvf->flow_cfg->flow_list, list) {
if (iter->dmac_filter && iter->entry == 0) {
@@ -1126,7 +1125,7 @@ static void otx2_update_rem_pfmac(struct otx2_nic *pfvf, int req)
otx2_dmacflt_remove(pfvf, eth_hdr->h_dest,
0);
clear_bit(0, &pfvf->flow_cfg->dmacflt_bmap);
- found = true;
+ flow = iter;
} else {
ether_addr_copy(eth_hdr->h_dest,
pfvf->netdev->dev_addr);
@@ -1136,9 +1135,9 @@ static void otx2_update_rem_pfmac(struct otx2_nic *pfvf, int req)
}
}
- if (found) {
- list_del(&iter->list);
- kfree(iter);
+ if (flow) {
+ list_del(&flow->list);
+ kfree(flow);
pfvf->flow_cfg->nr_flows--;
}
}
base-commit: f443e374ae131c168a065ea1748feac6b2e76613
--
2.25.1
Powered by blists - more mailing lists