[PATCH] RDMA/erdma: Drop redundant NULL check on error path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrey Vatoropin <a.vatoropin@xxxxxxx>

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@xxxxxxx>
---
 drivers/infiniband/hw/erdma/erdma_cm.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

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);
 
-- 
2.43.0





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux