diff mbox series

RDMA/erdma: Drop redundant NULL check on error path

Message ID 20250130075534.35847-1-a.vatoropin@crpt.ru (mailing list archive)
State Superseded
Headers show
Series RDMA/erdma: Drop redundant NULL check on error path | expand

Commit Message

Ваторопин Андрей Jan. 30, 2025, 7:55 a.m. UTC
From: Andrey Vatoropin <a.vatoropin@crpt.ru>

Static analysis shows that on the error handling path in the
get_mtt_entries() function, the mem->umem pointer cannot be NULL,
because it is pointer to struct.

Remove the extra NULL check. It is meaningless and harms the readability
of the code.
       
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>
---
 drivers/infiniband/hw/erdma/erdma_verbs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c b/drivers/infiniband/hw/erdma/erdma_verbs.c
index 51d619edb6c5..fe4b79f15cf6 100644
--- a/drivers/infiniband/hw/erdma/erdma_verbs.c
+++ b/drivers/infiniband/hw/erdma/erdma_verbs.c
@@ -794,10 +794,8 @@  static int get_mtt_entries(struct erdma_dev *dev, struct erdma_mem *mem,
 	return 0;
 
 error_ret:
-	if (mem->umem) {
-		ib_umem_release(mem->umem);
-		mem->umem = NULL;
-	}
+	ib_umem_release(mem->umem);
+	mem->umem = NULL;
 
 	return ret;
 }