aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/hfi1/file_ops.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-09 03:02:35 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-09 03:02:35 -0400
commit1236d6bb6e19fc72ffc6bbcdeb1bfefe450e54ee (patch)
tree47da3feee8e263e8c9352c85cf518e624be3c211 /drivers/infiniband/hw/hfi1/file_ops.c
parent750b1a6894ecc9b178c6e3d0a1170122971b2036 (diff)
parent8a5776a5f49812d29fe4b2d0a2d71675c3facf3f (diff)
Merge 4.14-rc4 into staging-next
We want the staging/iio fixes in here as well to handle merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/infiniband/hw/hfi1/file_ops.c')
-rw-r--r--drivers/infiniband/hw/hfi1/file_ops.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/hfi1/file_ops.c
index 2bc89260235a..d9a1e9893136 100644
--- a/drivers/infiniband/hw/hfi1/file_ops.c
+++ b/drivers/infiniband/hw/hfi1/file_ops.c
@@ -930,15 +930,8 @@ static int assign_ctxt(struct hfi1_filedata *fd, struct hfi1_user_info *uinfo)
930 switch (ret) { 930 switch (ret) {
931 case 0: 931 case 0:
932 ret = setup_base_ctxt(fd, uctxt); 932 ret = setup_base_ctxt(fd, uctxt);
933 if (uctxt->subctxt_cnt) { 933 if (ret)
934 /* 934 deallocate_ctxt(uctxt);
935 * Base context is done (successfully or not), notify
936 * anybody using a sub-context that is waiting for
937 * this completion.
938 */
939 clear_bit(HFI1_CTXT_BASE_UNINIT, &uctxt->event_flags);
940 wake_up(&uctxt->wait);
941 }
942 break; 935 break;
943 case 1: 936 case 1:
944 ret = complete_subctxt(fd); 937 ret = complete_subctxt(fd);
@@ -1305,25 +1298,25 @@ static int setup_base_ctxt(struct hfi1_filedata *fd,
1305 /* Now allocate the RcvHdr queue and eager buffers. */ 1298 /* Now allocate the RcvHdr queue and eager buffers. */
1306 ret = hfi1_create_rcvhdrq(dd, uctxt); 1299 ret = hfi1_create_rcvhdrq(dd, uctxt);
1307 if (ret) 1300 if (ret)
1308 return ret; 1301 goto done;
1309 1302
1310 ret = hfi1_setup_eagerbufs(uctxt); 1303 ret = hfi1_setup_eagerbufs(uctxt);
1311 if (ret) 1304 if (ret)
1312 goto setup_failed; 1305 goto done;
1313 1306
1314 /* If sub-contexts are enabled, do the appropriate setup */ 1307 /* If sub-contexts are enabled, do the appropriate setup */
1315 if (uctxt->subctxt_cnt) 1308 if (uctxt->subctxt_cnt)
1316 ret = setup_subctxt(uctxt); 1309 ret = setup_subctxt(uctxt);
1317 if (ret) 1310 if (ret)
1318 goto setup_failed; 1311 goto done;
1319 1312
1320 ret = hfi1_alloc_ctxt_rcv_groups(uctxt); 1313 ret = hfi1_alloc_ctxt_rcv_groups(uctxt);
1321 if (ret) 1314 if (ret)
1322 goto setup_failed; 1315 goto done;
1323 1316
1324 ret = init_user_ctxt(fd, uctxt); 1317 ret = init_user_ctxt(fd, uctxt);
1325 if (ret) 1318 if (ret)
1326 goto setup_failed; 1319 goto done;
1327 1320
1328 user_init(uctxt); 1321 user_init(uctxt);
1329 1322
@@ -1331,12 +1324,22 @@ static int setup_base_ctxt(struct hfi1_filedata *fd,
1331 fd->uctxt = uctxt; 1324 fd->uctxt = uctxt;
1332 hfi1_rcd_get(uctxt); 1325 hfi1_rcd_get(uctxt);
1333 1326
1334 return 0; 1327done:
1328 if (uctxt->subctxt_cnt) {
1329 /*
1330 * On error, set the failed bit so sub-contexts will clean up
1331 * correctly.
1332 */
1333 if (ret)
1334 set_bit(HFI1_CTXT_BASE_FAILED, &uctxt->event_flags);
1335 1335
1336setup_failed: 1336 /*
1337 /* Set the failed bit so sub-context init can do the right thing */ 1337 * Base context is done (successfully or not), notify anybody
1338 set_bit(HFI1_CTXT_BASE_FAILED, &uctxt->event_flags); 1338 * using a sub-context that is waiting for this completion.
1339 deallocate_ctxt(uctxt); 1339 */
1340 clear_bit(HFI1_CTXT_BASE_UNINIT, &uctxt->event_flags);
1341 wake_up(&uctxt->wait);
1342 }
1340 1343
1341 return ret; 1344 return ret;
1342} 1345}