No need to check for null pointer before calling rte_free().
Found by cocci/nullfree.cocci script.

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 drivers/net/bnxt/bnxt_ethdev.c | 3 +--
 drivers/net/bnxt/bnxt_vnic.c   | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index ee1552452a11..ec8e441a6d05 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -6002,8 +6002,7 @@ static void bnxt_free_ctx_mem_buf(struct 
bnxt_ctx_mem_buf_info *ctx)
        if (!ctx)
                return;
 
-       if (ctx->va)
-               rte_free(ctx->va);
+       rte_free(ctx->va);
 
        ctx->va = NULL;
        ctx->dma = RTE_BAD_IOVA;
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index 2be456956ddc..f86d27fd7965 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -847,8 +847,7 @@ bnxt_vnic_rss_hash_algo_update(struct bnxt *bp,
 
 int32_t bnxt_vnic_queue_db_deinit(struct bnxt *bp)
 {
-       if (bp->vnic_queue_db.rss_q_db != NULL)
-               rte_hash_free(bp->vnic_queue_db.rss_q_db);
+       rte_hash_free(bp->vnic_queue_db.rss_q_db);
        return 0;
 }
 
-- 
2.39.2

Reply via email to