diff options
-rw-r--r-- | drivers/infiniband/hw/qib/qib_file_ops.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c index 79d9971aff1f..75bfad16c114 100644 --- a/drivers/infiniband/hw/qib/qib_file_ops.c +++ b/drivers/infiniband/hw/qib/qib_file_ops.c | |||
@@ -1379,17 +1379,17 @@ static int get_a_ctxt(struct file *fp, const struct qib_user_info *uinfo, | |||
1379 | /* find device (with ACTIVE ports) with fewest ctxts in use */ | 1379 | /* find device (with ACTIVE ports) with fewest ctxts in use */ |
1380 | for (ndev = 0; ndev < devmax; ndev++) { | 1380 | for (ndev = 0; ndev < devmax; ndev++) { |
1381 | struct qib_devdata *dd = qib_lookup(ndev); | 1381 | struct qib_devdata *dd = qib_lookup(ndev); |
1382 | unsigned cused = 0, cfree = 0; | 1382 | unsigned cused = 0, cfree = 0, pusable = 0; |
1383 | if (!dd) | 1383 | if (!dd) |
1384 | continue; | 1384 | continue; |
1385 | if (port && port <= dd->num_pports && | 1385 | if (port && port <= dd->num_pports && |
1386 | usable(dd->pport + port - 1)) | 1386 | usable(dd->pport + port - 1)) |
1387 | dusable = 1; | 1387 | pusable = 1; |
1388 | else | 1388 | else |
1389 | for (i = 0; i < dd->num_pports; i++) | 1389 | for (i = 0; i < dd->num_pports; i++) |
1390 | if (usable(dd->pport + i)) | 1390 | if (usable(dd->pport + i)) |
1391 | dusable++; | 1391 | pusable++; |
1392 | if (!dusable) | 1392 | if (!pusable) |
1393 | continue; | 1393 | continue; |
1394 | for (ctxt = dd->first_user_ctxt; ctxt < dd->cfgctxts; | 1394 | for (ctxt = dd->first_user_ctxt; ctxt < dd->cfgctxts; |
1395 | ctxt++) | 1395 | ctxt++) |
@@ -1397,7 +1397,7 @@ static int get_a_ctxt(struct file *fp, const struct qib_user_info *uinfo, | |||
1397 | cused++; | 1397 | cused++; |
1398 | else | 1398 | else |
1399 | cfree++; | 1399 | cfree++; |
1400 | if (cfree && cused < inuse) { | 1400 | if (pusable && cfree && cused < inuse) { |
1401 | udd = dd; | 1401 | udd = dd; |
1402 | inuse = cused; | 1402 | inuse = cused; |
1403 | } | 1403 | } |