Skip to content

Commit a4db9be

Browse files
Junxian Huangnmorey
authored andcommitted
libhns: Fix ret not assigned in create srq()
[ Upstream commit 2034b18 ] Fix the problem that ret may not be assigned in the error flow of create_srq(). Fixes: b38bae4 ("libhns: Add support for lock-free SRQ") Fixes: b914c76 ("libhns: Refactor the process of create_srq") Signed-off-by: Junxian Huang <[email protected]> Signed-off-by: Nicolas Morey <[email protected]>
1 parent 225fbfb commit a4db9be

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

providers/hns/hns_roce_u_verbs.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -829,16 +829,20 @@ static struct ibv_srq *create_srq(struct ibv_context *context,
829829
if (pad)
830830
atomic_fetch_add(&pad->pd.refcount, 1);
831831

832-
if (hns_roce_srq_spinlock_init(srq, init_attr))
832+
ret = hns_roce_srq_spinlock_init(srq, init_attr);
833+
if (ret)
833834
goto err_free_srq;
834835

835836
set_srq_param(context, srq, init_attr);
836-
if (alloc_srq_buf(srq))
837+
ret = alloc_srq_buf(srq);
838+
if (ret)
837839
goto err_destroy_lock;
838840

839841
srq->rdb = hns_roce_alloc_db(hr_ctx, HNS_ROCE_SRQ_TYPE_DB);
840-
if (!srq->rdb)
842+
if (!srq->rdb) {
843+
ret = ENOMEM;
841844
goto err_srq_buf;
845+
}
842846

843847
ret = exec_srq_create_cmd(context, srq, init_attr);
844848
if (ret)

0 commit comments

Comments
 (0)