if (posix_memalign(&cq->buf, g_page_size,
align(nent * MTHCA_CQ_ENTRY_SIZE, g_page_size)))
- goto err;
+ goto err_memalign;
mthca_init_cq_buf(cq, nent);
err_unreg:
cl_free(cq->buf);
+err_memalign:
+ cl_spinlock_destroy(&cq->lock);
+
err:
cl_free(cq);
+
exit:
return ERR_PTR(-ENOMEM);
}
mthca_init_qp_indices(qp);
cl_spinlock_construct(&qp->sq.lock);
+ if (cl_spinlock_init(&qp->sq.lock)) {
+ ret = -EFAULT;
+ UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_QP ,("cl_spinlock_init failed for sq (%d)\n",ret));
+ goto err_spinlock_sq;
+ }
+
cl_spinlock_construct(&qp->rq.lock);
- if (cl_spinlock_init(&qp->sq.lock) || cl_spinlock_init(&qp->rq.lock)) {
+ if (cl_spinlock_init(&qp->rq.lock)) {
ret = -EFAULT;
- UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_QP ,("cl_spinlock_init failed (%d)\n",ret));
- goto err_spinlock;
+ UVP_PRINT(TRACE_LEVEL_ERROR ,UVP_DBG_QP ,("cl_spinlock_init failed for rq (%d)\n",ret));
+ goto err_spinlock_rq;
}
if (mthca_is_memfree(context)) {
MTHCA_DB_TYPE_SQ,
&qp->sq.db);
if (qp->sq.db_index < 0)
- goto err_spinlock;
+ goto err_sq_db;
qp->rq.db_index = mthca_alloc_db(to_mctx(context)->db_tab,
MTHCA_DB_TYPE_RQ,
&qp->rq.db);
if (qp->rq.db_index < 0)
- goto err_sq_db;
+ goto err_rq_db;
req->sq_db_page = db_align(qp->sq.db);
req->rq_db_page = db_align(qp->rq.db);
UVP_EXIT(UVP_DBG_QP);
return &qp->ibv_qp;
-err_sq_db:
+err_rq_db:
if (mthca_is_memfree(context))
mthca_free_db(to_mctx(context)->db_tab,
MTHCA_DB_TYPE_SQ, qp->sq.db_index);
-err_spinlock:
+err_sq_db:
+ cl_spinlock_destroy(&qp->rq.lock);
+
+err_spinlock_rq:
+ cl_spinlock_destroy(&qp->sq.lock);
+
+err_spinlock_sq:
cl_free(qp->wrid);
#ifdef NOT_USE_VIRTUAL_ALLOC
cl_free(qp->buf);