Signed-off-by: Michael Grzeschik <m.grzesc...@pengutronix.de>
---
 drivers/usb/chipidea/udc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 0c09542..13e3658 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -520,10 +520,12 @@ static int _hardware_dequeue(struct ci13xxx_ep *mEp, 
struct ci13xxx_req *mReq)
        else if ((TD_STATUS_TR_ERR & mReq->req.status) != 0)
                mReq->req.status = -1;
 
+       if (mReq->req.status)
+               return mReq->req.status;
+
        mReq->req.actual   = tmptoken & TD_TOTAL_BYTES;
        mReq->req.actual >>= __ffs(TD_TOTAL_BYTES);
        mReq->req.actual   = mReq->req.length - mReq->req.actual;
-       mReq->req.actual   = mReq->req.status ? 0 : mReq->req.actual;
 
        return mReq->req.actual;
 }
@@ -787,8 +789,10 @@ __acquires(mEp->lock)
        list_for_each_entry_safe(mReq, mReqTemp, &mEp->qh.queue,
                        queue) {
                retval = _hardware_dequeue(mEp, mReq);
-               if (retval < 0)
+               if (retval == -EBUSY) {
+                       retval = 0;
                        break;
+               }
                list_del_init(&mReq->queue);
                trace_ci_ep_complete_req(mEp, readl(&mReq->ptr->token), retval);
                if (mReq->req.complete != NULL) {
@@ -801,8 +805,6 @@ __acquires(mEp->lock)
                }
        }
 
-       if (retval == -EBUSY)
-               retval = 0;
        if (retval < 0)
                trace_ci_ep_complete_req(mEp, mReq->ptr->token, retval);
 
-- 
1.8.2.rc2

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to