Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 drivers/vdpa/mlx5/mlx5_vdpa_mem.c   | 3 +--
 drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_mem.c 
b/drivers/vdpa/mlx5/mlx5_vdpa_mem.c
index 130d201a85f5..599079500b03 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_mem.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_mem.c
@@ -283,8 +283,7 @@ mlx5_vdpa_mem_register(struct mlx5_vdpa_priv *priv)
        priv->gpa_mkey_index = entry->mkey->id;
        return 0;
 error:
-       if (entry)
-               rte_free(entry);
+       rte_free(entry);
        mlx5_vdpa_mem_dereg(priv);
        rte_errno = -ret;
        return ret;
diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c 
b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
index 2f32aef67fbc..3416797d289c 100644
--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
+++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c
@@ -91,8 +91,7 @@ mlx5_vdpa_virtq_unset(struct mlx5_vdpa_virtq *virtq)
                if (virtq->umems[i].obj)
                        claim_zero(mlx5_glue->devx_umem_dereg
                                                         (virtq->umems[i].obj));
-               if (virtq->umems[i].buf)
-                       rte_free(virtq->umems[i].buf);
+               rte_free(virtq->umems[i].buf);
        }
        memset(&virtq->umems, 0, sizeof(virtq->umems));
        if (virtq->eqp.fw_qp)
-- 
2.30.2

Reply via email to