diff mbox series

[75/82] vdpa/mlx5: remove unnecessary NULL checks

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

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Jan. 24, 2022, 12:05 a.m. UTC
Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@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 mbox series

Patch

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)