drivers/net: remove unnecessary null checks

The function rte_free() already handles NULL argument;
therefore the checks in this code are unnecessary.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Stephen Hemminger 2022-11-09 15:46:46 -08:00 committed by Thomas Monjalon
parent 6ff065b221
commit 742d8aaa81
4 changed files with 6 additions and 12 deletions

View File

@ -81,12 +81,10 @@ gve_free_qpls(struct gve_priv *priv)
for (i = 0; i < nb_txqs + nb_rxqs; i++) {
if (priv->qpl[i].mz != NULL)
rte_memzone_free(priv->qpl[i].mz);
if (priv->qpl[i].page_buses != NULL)
rte_free(priv->qpl[i].page_buses);
rte_free(priv->qpl[i].page_buses);
}
if (priv->qpl != NULL)
rte_free(priv->qpl);
rte_free(priv->qpl);
}
static int

View File

@ -255,8 +255,7 @@ reset_single_rx_queue(struct idpf_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;

View File

@ -537,8 +537,7 @@ static void mlx5dr_onesize_element_db_uninit(struct mlx5dr_pool *pool)
for (i = 0; i < MLX5DR_POOL_RESOURCE_ARR_SZ; i++) {
elem = pool->db.element_manager->elements[i];
if (elem) {
if (elem->bitmap)
rte_free(elem->bitmap);
rte_free(elem->bitmap);
simple_free(elem);
pool->db.element_manager->elements[i] = NULL;
}

View File

@ -7039,10 +7039,8 @@ flow_hw_configure(struct rte_eth_dev *dev,
if (dr_ctx)
claim_zero(mlx5dr_context_close(dr_ctx));
for (i = 0; i < nb_q_updated; i++) {
if (priv->hw_q[i].indir_iq)
rte_ring_free(priv->hw_q[i].indir_iq);
if (priv->hw_q[i].indir_cq)
rte_ring_free(priv->hw_q[i].indir_cq);
rte_ring_free(priv->hw_q[i].indir_iq);
rte_ring_free(priv->hw_q[i].indir_cq);
}
mlx5_free(priv->hw_q);
priv->hw_q = NULL;