]> git.openfabrics.org - ~emulex/libocrdma.git/commitdiff
RDMA/libocrdma: return error if destroy fails libocrdma-1.0.5
authorPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Sat, 17 Jan 2015 09:24:07 +0000 (14:54 +0530)
committerPadmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
Sat, 17 Jan 2015 09:24:07 +0000 (14:54 +0530)
If the destorying of any resource has failed at uverbs
command interface libocrdma should return the error code.

Signed-off-by: Padmanabh Ratnakar <padmanabh.ratnakar@emulex.com>
src/ocrdma_verbs.c

index c089a5ff1f664372aa5d14852621f865d3941c97..cf2ecd2894e6fc5ff57152196e9fb80324a5fc84 100644 (file)
@@ -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)