diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2019-05-28 14:37:28 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2019-06-11 23:17:10 +0300 |
commit | a52c8e2469c30cf7ac453d624aed9c168b23d1af (patch) | |
tree | 6e2b5b8f8d37a23f0ebe3630bb0fb1202e8d10f5 /drivers/infiniband/hw/nes | |
parent | 147b308e6a63a0572b750b1dc9b8b6fc33997e4b (diff) | |
download | linux-a52c8e2469c30cf7ac453d624aed9c168b23d1af.tar.xz |
RDMA: Clean destroy CQ in drivers do not return errors
Like all other destroy commands, .destroy_cq() call is not supposed
to fail. In all flows, the attempt to return earlier caused to memory
leaks.
This patch converts .destroy_cq() to do not return any errors.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Gal Pressman <galpress@amazon.com>
Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/nes')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_utils.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_verbs.c | 30 |
2 files changed, 10 insertions, 24 deletions
diff --git a/drivers/infiniband/hw/nes/nes_utils.c b/drivers/infiniband/hw/nes/nes_utils.c index 90f28890246d..e976292fc6c0 100644 --- a/drivers/infiniband/hw/nes/nes_utils.c +++ b/drivers/infiniband/hw/nes/nes_utils.c @@ -588,9 +588,7 @@ struct nes_cqp_request *nes_get_cqp_request(struct nes_device *nesdev) cqp_request->callback = 0; nes_debug(NES_DBG_CQP, "Got cqp request %p from the available list \n", cqp_request); - } else - printk(KERN_ERR PFX "%s: Could not allocated a CQP request.\n", - __func__); + } return cqp_request; } diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 7677f1f734bb..cac3fa624c4d 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c @@ -1634,7 +1634,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, /** * nes_destroy_cq */ -static int nes_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) +static void nes_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) { struct nes_cq *nescq; struct nes_device *nesdev; @@ -1644,7 +1644,6 @@ static int nes_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) struct nes_cqp_request cqp_request = {}; unsigned long flags; u32 opcode = 0; - int ret; nescq = to_nescq(ib_cq); nesvnic = to_nesvnic(ib_cq->device); @@ -1656,6 +1655,7 @@ static int nes_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) /* Send DestroyCQ request to CQP */ INIT_LIST_HEAD(&cqp_request.list); init_waitqueue_head(&cqp_request.waitq); + cqp_request.waiting = 1; cqp_wqe = &cqp_request.cqp_wqe; opcode = NES_CQP_DESTROY_CQ | (nescq->hw_cq.cq_size << 16); @@ -1689,30 +1689,18 @@ static int nes_destroy_cq(struct ib_cq *ib_cq, struct ib_udata *udata) /* Wait for CQP */ nes_debug(NES_DBG_CQ, "Waiting for destroy iWARP CQ%u to complete.\n", nescq->hw_cq.cq_number); - ret = wait_event_timeout(cqp_request.waitq, cqp_request.request_done, - NES_EVENT_TIMEOUT); - nes_debug(NES_DBG_CQ, "Destroy iWARP CQ%u completed, wait_event_timeout ret = %u," - " CQP Major:Minor codes = 0x%04X:0x%04X.\n", - nescq->hw_cq.cq_number, ret, cqp_request.major_code, - cqp_request.minor_code); - if (!ret) { - nes_debug(NES_DBG_CQ, "iWARP CQ%u destroy timeout expired\n", - nescq->hw_cq.cq_number); - ret = -ETIME; - } else if (cqp_request.major_code) { - nes_debug(NES_DBG_CQ, "iWARP CQ%u destroy failed\n", - nescq->hw_cq.cq_number); - ret = -EIO; - } else { - ret = 0; - } + wait_event_timeout(cqp_request.waitq, cqp_request.request_done, + NES_EVENT_TIMEOUT); + nes_debug( + NES_DBG_CQ, + "Destroy iWARP CQ%u completed CQP Major:Minor codes = 0x%04X:0x%04X.\n", + nescq->hw_cq.cq_number, cqp_request.major_code, + cqp_request.minor_code); if (nescq->cq_mem_size) pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, nescq->hw_cq.cq_vbase, nescq->hw_cq.cq_pbase); kfree(nescq); - - return ret; } /** |