[PATCH 50/82] net/i40e: remove unnecessary NULL checks
Stephen Hemminger
stephen at networkplumber.org
Mon Jan 24 01:04:46 CET 2022
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/net/i40e/i40e_ethdev.c | 27 +++++++++------------------
drivers/net/i40e/i40e_rxtx.c | 3 +--
2 files changed, 10 insertions(+), 20 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 1d417dbf8ad7..ecfa3c94db44 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1781,10 +1781,8 @@ i40e_rm_ethtype_filter_list(struct i40e_pf *pf)
ethertype_rule = &pf->ethertype;
/* Remove all ethertype filter rules and hash */
- if (ethertype_rule->hash_map)
- rte_free(ethertype_rule->hash_map);
- if (ethertype_rule->hash_table)
- rte_hash_free(ethertype_rule->hash_table);
+ rte_free(ethertype_rule->hash_map);
+ rte_hash_free(ethertype_rule->hash_table);
while ((p_ethertype = TAILQ_FIRST(ðertype_rule->ethertype_list))) {
TAILQ_REMOVE(ðertype_rule->ethertype_list,
@@ -1801,10 +1799,8 @@ i40e_rm_tunnel_filter_list(struct i40e_pf *pf)
tunnel_rule = &pf->tunnel;
/* Remove all tunnel director rules and hash */
- if (tunnel_rule->hash_map)
- rte_free(tunnel_rule->hash_map);
- if (tunnel_rule->hash_table)
- rte_hash_free(tunnel_rule->hash_table);
+ rte_free(tunnel_rule->hash_map);
+ rte_hash_free(tunnel_rule->hash_table);
while ((p_tunnel = TAILQ_FIRST(&tunnel_rule->tunnel_list))) {
TAILQ_REMOVE(&tunnel_rule->tunnel_list, p_tunnel, rules);
@@ -1833,16 +1829,11 @@ i40e_fdir_memory_cleanup(struct i40e_pf *pf)
fdir_info = &pf->fdir;
/* flow director memory cleanup */
- if (fdir_info->hash_map)
- rte_free(fdir_info->hash_map);
- if (fdir_info->hash_table)
- rte_hash_free(fdir_info->hash_table);
- if (fdir_info->fdir_flow_pool.bitmap)
- rte_free(fdir_info->fdir_flow_pool.bitmap);
- if (fdir_info->fdir_flow_pool.pool)
- rte_free(fdir_info->fdir_flow_pool.pool);
- if (fdir_info->fdir_filter_array)
- rte_free(fdir_info->fdir_filter_array);
+ rte_free(fdir_info->hash_map);
+ rte_hash_free(fdir_info->hash_table);
+ rte_free(fdir_info->fdir_flow_pool.bitmap);
+ rte_free(fdir_info->fdir_flow_pool.pool);
+ rte_free(fdir_info->fdir_filter_array);
}
void i40e_flex_payload_reg_set_default(struct i40e_hw *hw)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 9a00a9b71e2c..25a28ecea22c 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2573,8 +2573,7 @@ i40e_reset_rx_queue(struct i40e_rx_queue *rxq)
rxq->rx_tail = 0;
rxq->nb_rx_hold = 0;
- if (rxq->pkt_first_seg != NULL)
- rte_pktmbuf_free(rxq->pkt_first_seg);
+ rte_pktmbuf_free(rxq->pkt_first_seg);
rxq->pkt_first_seg = NULL;
rxq->pkt_last_seg = NULL;
--
2.30.2
More information about the dev
mailing list