[azure:x/azure-edge:x,2/6] UBUNTU: SAUCE: vmbus-rdma: ND142: remove idr handle before calling ND on freeing CQ and QP
diff mbox series

Message ID 1518623897-18991-3-git-send-email-marcelo.cerri@canonical.com
State New
Headers show
Series
  • Fixes for Network Direct InfiniBand/RDMA driver
Related show

Commit Message

Marcelo Henrique Cerri Feb. 14, 2018, 3:58 p.m. UTC
From: Long Li <longli@microsoft.com>

BugLink: http://bugs.launchpad.net/bugs/1749332

Signed-off-by: Long Li <longli@microsoft.com>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
---
 .../hw/vmbus-rdma/vmbus-rdma-142.0/vmbus_rdma.c    | 24 +++++-----------------
 1 file changed, 5 insertions(+), 19 deletions(-)

Patch
diff mbox series

diff --git a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-142.0/vmbus_rdma.c b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-142.0/vmbus_rdma.c
index daf68dcccb1b..58f2484fb819 100644
--- a/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-142.0/vmbus_rdma.c
+++ b/drivers/infiniband/hw/vmbus-rdma/vmbus-rdma-142.0/vmbus_rdma.c
@@ -1023,9 +1023,9 @@  int hvnd_create_cq(struct hvnd_dev *nd_dev, struct hvnd_ucontext *uctx,
 int hvnd_destroy_cq(struct hvnd_dev *nd_dev, struct hvnd_cq *cq)
 {
 	struct pkt_nd_free_cq free_cq_pkt;
-	int ret;
 
-	// KYS try to avoid having to zero everything
+	remove_handle(nd_dev, &nd_dev->cqidr, cq->cqn);
+
 	memset(&free_cq_pkt, 0, sizeof(free_cq_pkt));
 	hvnd_init_hdr(&free_cq_pkt.hdr,
 		      sizeof(struct pkt_nd_free_cq) -
@@ -1040,19 +1040,9 @@  int hvnd_destroy_cq(struct hvnd_dev *nd_dev, struct hvnd_cq *cq)
 	free_cq_pkt.ioctl.in.version = ND_VERSION_1;
 	free_cq_pkt.ioctl.in.handle = cq->cq_handle;
 
-	ret = hvnd_send_ioctl_pkt(nd_dev, &free_cq_pkt.hdr,
+	return hvnd_send_ioctl_pkt(nd_dev, &free_cq_pkt.hdr,
 			       sizeof(struct pkt_nd_free_cq),
 			       (u64)&free_cq_pkt);
-
-	if (ret)
-		goto free_cq_err;
-
-	remove_handle(nd_dev, &nd_dev->cqidr, cq->cqn);
-
-	return 0;
-
-free_cq_err:
-	return ret;
 }
 
 
@@ -2291,12 +2281,8 @@  int hvnd_create_qp(struct hvnd_dev *nd_dev, struct hvnd_ucontext *uctx,
 int hvnd_free_qp(struct hvnd_dev *nd_dev, struct hvnd_ucontext *uctx,
 		 struct hvnd_qp *qp)
 {
-	int ret;
-
-	ret = hvnd_free_handle(nd_dev, uctx, qp->qp_handle, IOCTL_ND_QP_FREE);
-	if (ret == 0)
-		remove_handle(nd_dev, &nd_dev->qpidr, qp->qpn);
-	return ret;
+	remove_handle(nd_dev, &nd_dev->qpidr, qp->qpn);
+	return hvnd_free_handle(nd_dev, uctx, qp->qp_handle, IOCTL_ND_QP_FREE);
 }
 
 int hvnd_flush_qp(struct hvnd_dev *nd_dev, struct hvnd_ucontext *uctx,