diff mbox series

RDMA/erdma: Drop redundant NULL check on error path

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

Commit Message

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

Static analysis shows that on the error handling path in the
erdma_connect() function, the socket pointer cannot be NULL, since it is
pre-initialized in sock_create().  A potential failure in sock_create()
is processed.

Remove the extra NULL check. It is meaningless and harms the readability
of the code, since before that the socket pointer is unconditionally
dereferenced.

Found by Linux Verification Center (linuxtesting.org) with SVACE.
       
Signed-off-by: Andrey Vatoropin <a.vatoropin@crpt.ru>
---
 drivers/infiniband/hw/erdma/erdma_cm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
index 771059a8eb7d..2934081dfbd4 100644
--- a/drivers/infiniband/hw/erdma/erdma_cm.c
+++ b/drivers/infiniband/hw/erdma/erdma_cm.c
@@ -1116,8 +1116,7 @@  int erdma_connect(struct iw_cm_id *id, struct iw_cm_conn_param *params)
 	erdma_cep_put(cep);
 
 error_release_sock:
-	if (s)
-		sock_release(s);
+	sock_release(s);
 error_put_qp:
 	erdma_qp_put(qp);