[v2,25/83] common/mlx5: remove unnecessary NULL checks

Message ID 20220124174719.14417-26-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series remove unnecessary null checks |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 24, 2022, 5:46 p.m. UTC
  Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/common/mlx5/mlx5_common_mr.c  | 3 +--
 drivers/common/mlx5/mlx5_common_pci.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/common/mlx5/mlx5_common_mr.c b/drivers/common/mlx5/mlx5_common_mr.c
index 1537b5d42879..07f76a10655f 100644
--- a/drivers/common/mlx5/mlx5_common_mr.c
+++ b/drivers/common/mlx5/mlx5_common_mr.c
@@ -516,8 +516,7 @@  mlx5_mr_free(struct mlx5_mr *mr, mlx5_dereg_mr_t dereg_mr_cb)
 		return;
 	DRV_LOG(DEBUG, "freeing MR(%p):", (void *)mr);
 	dereg_mr_cb(&mr->pmd_mr);
-	if (mr->ms_bmp != NULL)
-		rte_bitmap_free(mr->ms_bmp);
+	rte_bitmap_free(mr->ms_bmp);
 	mlx5_free(mr);
 }
 
diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 8b38091d8741..458630351cd1 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -97,8 +97,7 @@  pci_ids_table_update(const struct rte_pci_id *driver_id_table)
 	updated_table[i].vendor_id = 0;
 	mlx5_common_pci_driver.id_table = updated_table;
 	mlx5_pci_id_table = updated_table;
-	if (old_table)
-		free(old_table);
+	free(old_table);
 	return 0;
 }