aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2018-12-17 13:20:45 -0800
committerDoug Ledford <dledford@redhat.com>2018-12-19 15:07:26 -0500
commit82305f8235622a97f29ff6e82cc97cab6ac543ea (patch)
tree7f9ff73eea78456be597e6ff5be8c33e735a36a7 /drivers/infiniband
parentRDMA/srpt: Remove driver version and release date (diff)
downloadlinux-dev-82305f8235622a97f29ff6e82cc97cab6ac543ea.tar.xz
linux-dev-82305f8235622a97f29ff6e82cc97cab6ac543ea.zip
RDMA/srpt: Rework the srpt_alloc_srq() error path
This patch does not change any functionality but makes the next patch easier to read. Cc: Sergey Gorenko <sergeygo@mellanox.com> Cc: Max Gurtovoy <maxg@mellanox.com> Cc: Laurence Oberman <loberman@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 7d5acb1ff35a..772d75620b48 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2942,10 +2942,8 @@ static int srpt_alloc_srq(struct srpt_device *sdev)
srpt_alloc_ioctx_ring(sdev, sdev->srq_size,
sizeof(*sdev->ioctx_ring[0]),
srp_max_req_size, DMA_FROM_DEVICE);
- if (!sdev->ioctx_ring) {
- ib_destroy_srq(srq);
- return -ENOMEM;
- }
+ if (!sdev->ioctx_ring)
+ goto free_srq;
sdev->use_srq = true;
sdev->srq = srq;
@@ -2956,6 +2954,10 @@ static int srpt_alloc_srq(struct srpt_device *sdev)
}
return 0;
+
+free_srq:
+ ib_destroy_srq(srq);
+ return -ENOMEM;
}
static int srpt_use_srq(struct srpt_device *sdev, bool use_srq)