[PATCH v2 25/83] common/mlx5: remove unnecessary NULL checks
Stephen Hemminger
stephen at networkplumber.org
Mon Jan 24 18:46:21 CET 2022
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci
Signed-off-by: Stephen Hemminger <stephen at 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(-)
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;
}
--
2.30.2
More information about the dev
mailing list