Skip to content

Commit 82305f8

Browse files
bvanasschedledford
authored andcommitted
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 <[email protected]> Cc: Max Gurtovoy <[email protected]> Cc: Laurence Oberman <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 6feb64f commit 82305f8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/infiniband/ulp/srpt/ib_srpt.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2942,10 +2942,8 @@ static int srpt_alloc_srq(struct srpt_device *sdev)
29422942
srpt_alloc_ioctx_ring(sdev, sdev->srq_size,
29432943
sizeof(*sdev->ioctx_ring[0]),
29442944
srp_max_req_size, DMA_FROM_DEVICE);
2945-
if (!sdev->ioctx_ring) {
2946-
ib_destroy_srq(srq);
2947-
return -ENOMEM;
2948-
}
2945+
if (!sdev->ioctx_ring)
2946+
goto free_srq;
29492947

29502948
sdev->use_srq = true;
29512949
sdev->srq = srq;
@@ -2956,6 +2954,10 @@ static int srpt_alloc_srq(struct srpt_device *sdev)
29562954
}
29572955

29582956
return 0;
2957+
2958+
free_srq:
2959+
ib_destroy_srq(srq);
2960+
return -ENOMEM;
29592961
}
29602962

29612963
static int srpt_use_srq(struct srpt_device *sdev, bool use_srq)

0 commit comments

Comments
 (0)