No need to check for null before calling free.
Found by coccinelle script null_free.

Signed-off-by: Stephen Hemminger <[email protected]>
---
 drivers/net/bnxt/tf_core/v3/tfo.c    | 6 ++----
 drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c | 6 ++----
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/tf_core/v3/tfo.c 
b/drivers/net/bnxt/tf_core/v3/tfo.c
index 4b1f545476..681d1dd8d3 100644
--- a/drivers/net/bnxt/tf_core/v3/tfo.c
+++ b/drivers/net/bnxt/tf_core/v3/tfo.c
@@ -183,13 +183,11 @@ void tfo_close(void **tfo)
                                }
                        }
                }
-               if (tim)
-                       rte_free(tim);
+               rte_free(tim);
                tfco->ts_tim = NULL;
                tfco->tfgo = NULL;
 
-               if (*tfo)
-                       rte_free(*tfo);
+               rte_free(*tfo);
                *tfo = NULL;
        }
 }
diff --git a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c 
b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
index 23e1b59ca4..3707cd1a2d 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c
@@ -169,11 +169,9 @@ ulp_sc_mgr_deinit(struct bnxt_ulp_context *ctxt)
 
        ulp_sc_mgr_thread_cancel(ctxt);
 
-       if (ulp_sc_info->stats_cache_tbl)
-               rte_free(ulp_sc_info->stats_cache_tbl);
+       rte_free(ulp_sc_info->stats_cache_tbl);
 
-       if (ulp_sc_info->read_data)
-               rte_free(ulp_sc_info->read_data);
+       rte_free(ulp_sc_info->read_data);
 
        rte_free(ulp_sc_info);
 
-- 
2.53.0

Reply via email to