diff options
author | Mike Lockwood <lockwood@android.com> | 2011-01-13 16:19:57 -0500 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:38:27 -0800 |
commit | 12f880372b366619a0082174bbc3e851c504fa27 (patch) | |
tree | 17a599bc6a97c884b7b27a86edc2cab82d1f9b16 /drivers | |
parent | 13c9dd32f27a5cf9976b7199be7facf1a2d7d2ba (diff) |
USB: gadget: f_mtp: Make sure request is dequeued if transfer is canceled
If the host cancels a file transfer while we have a read request pending,
call usb_ep_dequeue to cancel the read.
Also return -ECANCELED from mtp_ioctl if we are canceled in MTP_RECEIVE_FILE
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_mtp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/gadget/f_mtp.c b/drivers/usb/gadget/f_mtp.c index 64fe3b3cd9e6..e07224fd9f89 100644 --- a/drivers/usb/gadget/f_mtp.c +++ b/drivers/usb/gadget/f_mtp.c @@ -756,8 +756,10 @@ static void receive_file_work(struct work_struct *data) /* wait for our last read to complete */ ret = wait_event_interruptible(dev->read_wq, dev->rx_done || dev->state != STATE_BUSY); - if (ret < 0 || dev->state != STATE_BUSY) { - r = ret; + if (dev->state == STATE_CANCELED) { + r = -ECANCELED; + if (!dev->rx_done) + usb_ep_dequeue(dev->ep_out, read_req); break; } /* if xfer_file_length is 0xFFFFFFFF, then we read until |