aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/inode.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 1c5e1ee7e36b..34296e79edcf 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -576,7 +576,6 @@ static ssize_t ep_aio_read_retry(struct kiocb *iocb)
576 } 576 }
577 kfree(priv->buf); 577 kfree(priv->buf);
578 kfree(priv); 578 kfree(priv);
579 aio_put_req(iocb);
580 return len; 579 return len;
581} 580}
582 581
@@ -590,18 +589,17 @@ static void ep_aio_complete(struct usb_ep *ep, struct usb_request *req)
590 spin_lock(&epdata->dev->lock); 589 spin_lock(&epdata->dev->lock);
591 priv->req = NULL; 590 priv->req = NULL;
592 priv->epdata = NULL; 591 priv->epdata = NULL;
593 if (priv->iv == NULL 592
594 || unlikely(req->actual == 0) 593 /* if this was a write or a read returning no data then we
595 || unlikely(kiocbIsCancelled(iocb))) { 594 * don't need to copy anything to userspace, so we can
595 * complete the aio request immediately.
596 */
597 if (priv->iv == NULL || unlikely(req->actual == 0)) {
596 kfree(req->buf); 598 kfree(req->buf);
597 kfree(priv); 599 kfree(priv);
598 iocb->private = NULL; 600 iocb->private = NULL;
599 /* aio_complete() reports bytes-transferred _and_ faults */ 601 /* aio_complete() reports bytes-transferred _and_ faults */
600 if (unlikely(kiocbIsCancelled(iocb))) 602 aio_complete(iocb, req->actual ? req->actual : req->status,
601 aio_put_req(iocb);
602 else
603 aio_complete(iocb,
604 req->actual ? req->actual : req->status,
605 req->status); 603 req->status);
606 } else { 604 } else {
607 /* retry() won't report both; so we hide some faults */ 605 /* retry() won't report both; so we hide some faults */