net/bnxt: remove unnecessary checks for null pointer
PATCH 1/1 net/bnxt: remove unnecessary checks for null pointer
The function rte_free() handles a NULL pointer as no-op. This patch was automatically generated from nullfree.cocci script.
Signed-off-by Stephen Hemminger <[email protected]>
--- drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c | 6 ++---- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 3 +-- drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-)
drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c +2 -4
@@ -1668,10 +1668,8 @@ int tfc_tbl_scope_cpm_alloc(struct tfc *tfcp, uint8_t tsid,return 0 ; cleanup: -if (cmm_lkup !=NULL ) -rte_free (cmm_lkup); -if (cmm_act !=NULL ) -rte_free (cmm_act); +rte_free (cmm_lkup); +rte_free (cmm_act);return rc; }
drivers/net/bnxt/tf_ulp/ulp_mapper.c +1 -2
@@ -1359,8 +1359,7 @@ ulp_mapper_key_recipe_tbl_deinit(struct bnxt_ulp_mapper_data *mdata) recipes = mdata->key_recipe_info.recipes[dir][ftype];for (idx =0 ; idx < mdata->key_recipe_info.num_recipes; idx++) { -if (recipes[idx]) -rte_free (recipes[idx]); +rte_free (recipes[idx]); }rte_free (mdata->key_recipe_info.recipes[dir][ftype]); mdata->key_recipe_info.recipes[dir][ftype] =NULL ;
drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c +2 -4
@@ -158,11 +158,9 @@ ulp_sc_mgr_deinit(struct bnxt_ulp_context *ctxt)if (!ulp_sc_info)return -EINVAL ; -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);
Signature · 1 line
2.45.2
Quoted 5 lines · Stephen Hemminger
The function
rte_free()handles a NULL pointer as no-op. This patch was automatically generated fromnullfree.cocciscript.Signed-off-by Stephen Hemminger <[email protected]>
Acked-by Ajit Khaparde <[email protected]>
Quoted 58 lines
--- drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c | 6 ++---- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 3 +-- drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-)drivers/net/bnxt/tf_core/v3/tfc_tbl_scope.c +2
-4@@ -1668,10 +1668,8 @@ int tfc_tbl_scope_cpm_alloc(struct tfc *tfcp, uint8_t tsid,return 0 ; cleanup: -if (cmm_lkup !=NULL ) -rte_free (cmm_lkup); -if (cmm_act !=NULL ) -rte_free (cmm_act); +rte_free (cmm_lkup); +rte_free (cmm_act);return rc; }drivers/net/bnxt/tf_ulp/ulp_mapper.c +1
-2@@ -1359,8 +1359,7 @@ ulp_mapper_key_recipe_tbl_deinit(struct bnxt_ulp_mapper_data *mdata) recipes = mdata->key_recipe_info.recipes[dir][ftype];for (idx =0 ; idx < mdata->key_recipe_info.num_recipes; idx++) { -if (recipes[idx]) -rte_free (recipes[idx]); +rte_free (recipes[idx]); }rte_free (mdata->key_recipe_info.recipes[dir][ftype]); mdata->key_recipe_info.recipes[dir][ftype] =NULL ;drivers/net/bnxt/tf_ulp/ulp_sc_mgr.c +2
-5@@ -158,11 +158,9 @@ ulp_sc_mgr_deinit(struct bnxt_ulp_context *ctxt)if (!ulp_sc_info)return -EINVAL ; -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.45.2