Commit faa98b86 authored by Mitko Haralanov's avatar Mitko Haralanov Committed by Greg Kroah-Hartman

staging/rdma/hfi1: Clean-up unnecessary goto statements

Clean-up unnecessary goto statements based on feedback from the
mailing list on previous patch submissions.
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarMitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a0d40693
...@@ -497,15 +497,13 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, ...@@ -497,15 +497,13 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,
"[%u:%u:%u] First vector not big enough for header %lu/%lu", "[%u:%u:%u] First vector not big enough for header %lu/%lu",
dd->unit, uctxt->ctxt, fd->subctxt, dd->unit, uctxt->ctxt, fd->subctxt,
iovec[idx].iov_len, sizeof(info) + sizeof(req->hdr)); iovec[idx].iov_len, sizeof(info) + sizeof(req->hdr));
ret = -EINVAL; return -EINVAL;
goto done;
} }
ret = copy_from_user(&info, iovec[idx].iov_base, sizeof(info)); ret = copy_from_user(&info, iovec[idx].iov_base, sizeof(info));
if (ret) { if (ret) {
hfi1_cdbg(SDMA, "[%u:%u:%u] Failed to copy info QW (%d)", hfi1_cdbg(SDMA, "[%u:%u:%u] Failed to copy info QW (%d)",
dd->unit, uctxt->ctxt, fd->subctxt, ret); dd->unit, uctxt->ctxt, fd->subctxt, ret);
ret = -EFAULT; return -EFAULT;
goto done;
} }
trace_hfi1_sdma_user_reqinfo(dd, uctxt->ctxt, fd->subctxt, trace_hfi1_sdma_user_reqinfo(dd, uctxt->ctxt, fd->subctxt,
(u16 *)&info); (u16 *)&info);
...@@ -513,15 +511,13 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, ...@@ -513,15 +511,13 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,
hfi1_cdbg(SDMA, "[%u:%u:%u] Entry %u is in QUEUED state", hfi1_cdbg(SDMA, "[%u:%u:%u] Entry %u is in QUEUED state",
dd->unit, uctxt->ctxt, fd->subctxt, dd->unit, uctxt->ctxt, fd->subctxt,
info.comp_idx); info.comp_idx);
ret = -EBADSLT; return -EBADSLT;
goto done;
} }
if (!info.fragsize) { if (!info.fragsize) {
hfi1_cdbg(SDMA, hfi1_cdbg(SDMA,
"[%u:%u:%u:%u] Request does not specify fragsize", "[%u:%u:%u:%u] Request does not specify fragsize",
dd->unit, uctxt->ctxt, fd->subctxt, info.comp_idx); dd->unit, uctxt->ctxt, fd->subctxt, info.comp_idx);
ret = -EINVAL; return -EINVAL;
goto done;
} }
/* /*
* We've done all the safety checks that we can up to this point, * We've done all the safety checks that we can up to this point,
...@@ -550,8 +546,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec, ...@@ -550,8 +546,7 @@ int hfi1_user_sdma_process_request(struct file *fp, struct iovec *iovec,
if (!info.npkts || req->data_iovs > MAX_VECTORS_PER_REQ) { if (!info.npkts || req->data_iovs > MAX_VECTORS_PER_REQ) {
SDMA_DBG(req, "Too many vectors (%u/%u)", req->data_iovs, SDMA_DBG(req, "Too many vectors (%u/%u)", req->data_iovs,
MAX_VECTORS_PER_REQ); MAX_VECTORS_PER_REQ);
ret = -EINVAL; return -EINVAL;
goto done;
} }
/* Copy the header from the user buffer */ /* Copy the header from the user buffer */
ret = copy_from_user(&req->hdr, iovec[idx].iov_base + sizeof(info), ret = copy_from_user(&req->hdr, iovec[idx].iov_base + sizeof(info),
...@@ -774,10 +769,8 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) ...@@ -774,10 +769,8 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
struct hfi1_user_sdma_pkt_q *pq = NULL; struct hfi1_user_sdma_pkt_q *pq = NULL;
struct user_sdma_iovec *iovec = NULL; struct user_sdma_iovec *iovec = NULL;
if (!req->pq) { if (!req->pq)
ret = -EINVAL; return -EINVAL;
goto done;
}
pq = req->pq; pq = req->pq;
...@@ -787,7 +780,7 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) ...@@ -787,7 +780,7 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
if (unlikely(req->seqnum == req->info.npkts)) { if (unlikely(req->seqnum == req->info.npkts)) {
if (!list_empty(&req->txps)) if (!list_empty(&req->txps))
goto dosend; goto dosend;
goto done; return ret;
} }
if (!maxpkts || maxpkts > req->info.npkts - req->seqnum) if (!maxpkts || maxpkts > req->info.npkts - req->seqnum)
...@@ -804,15 +797,13 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) ...@@ -804,15 +797,13 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
*/ */
if (test_bit(SDMA_REQ_HAS_ERROR, &req->flags)) { if (test_bit(SDMA_REQ_HAS_ERROR, &req->flags)) {
set_bit(SDMA_REQ_DONE_ERROR, &req->flags); set_bit(SDMA_REQ_DONE_ERROR, &req->flags);
ret = -EFAULT; return -EFAULT;
goto done;
} }
tx = kmem_cache_alloc(pq->txreq_cache, GFP_KERNEL); tx = kmem_cache_alloc(pq->txreq_cache, GFP_KERNEL);
if (!tx) { if (!tx)
ret = -ENOMEM; return -ENOMEM;
goto done;
}
tx->flags = 0; tx->flags = 0;
tx->req = req; tx->req = req;
tx->busycount = 0; tx->busycount = 0;
...@@ -1013,12 +1004,12 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts) ...@@ -1013,12 +1004,12 @@ static int user_sdma_send_pkts(struct user_sdma_request *req, unsigned maxpkts)
if (test_bit(SDMA_REQ_HAVE_AHG, &req->flags)) if (test_bit(SDMA_REQ_HAVE_AHG, &req->flags))
sdma_ahg_free(req->sde, req->ahg_idx); sdma_ahg_free(req->sde, req->ahg_idx);
} }
goto done; return ret;
free_txreq: free_txreq:
sdma_txclean(pq->dd, &tx->txreq); sdma_txclean(pq->dd, &tx->txreq);
free_tx: free_tx:
kmem_cache_free(pq->txreq_cache, tx); kmem_cache_free(pq->txreq_cache, tx);
done:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment