From f5d704f4bc0192a38eca98611635e4ee8f22eda5 Mon Sep 17 00:00:00 2001 From: Padmanabh Ratnakar Date: Sat, 17 Jan 2015 14:54:07 +0530 Subject: [PATCH] RDMA/libocrdma: return error if destroy fails If the destorying of any resource has failed at uverbs command interface libocrdma should return the error code. Signed-off-by: Padmanabh Ratnakar --- src/ocrdma_verbs.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ocrdma_verbs.c b/src/ocrdma_verbs.c index c089a5f..cf2ecd2 100644 --- a/src/ocrdma_verbs.c +++ b/src/ocrdma_verbs.c @@ -209,10 +209,11 @@ int ocrdma_free_pd(struct ibv_pd *ibpd) struct ocrdma_pd *pd = get_ocrdma_pd(ibpd); status = ibv_cmd_dealloc_pd(ibpd); - if (pd->dpp_va) - munmap((void *)pd->dpp_va, OCRDMA_DPP_PAGE_SIZE); if (status) return status; + + if (pd->dpp_va) + munmap((void *)pd->dpp_va, OCRDMA_DPP_PAGE_SIZE); free(pd); return 0; } @@ -356,8 +357,12 @@ int ocrdma_resize_cq(struct ibv_cq *ibcq, int new_entries) int ocrdma_destroy_cq(struct ibv_cq *ibv_cq) { struct ocrdma_cq *cq = get_ocrdma_cq(ibv_cq); + int status; + + status = ibv_cmd_destroy_cq(ibv_cq); + if (status) + return status; - ibv_cmd_destroy_cq(ibv_cq); if (cq->db_va) munmap((void *)cq->db_va, cq->db_size); if (cq->va) @@ -484,6 +489,9 @@ int ocrdma_destroy_srq(struct ibv_srq *ibsrq) id = dev->id; status = ibv_cmd_destroy_srq(ibsrq); + if (status) + return status; + if (srq->idx_bit_fields) free(srq->idx_bit_fields); if (srq->rqe_wr_id_tbl) -- 2.46.0