diff options
author | Hemant Kumar <hemantk@codeaurora.org> | 2016-05-02 10:50:35 -0700 |
---|---|---|
committer | Kyle Yan <kyan@codeaurora.org> | 2016-06-10 15:13:49 -0700 |
commit | 78ece44dc6d8c93e1f5ba4b87a20a7ea08d7a6be (patch) | |
tree | a2b467da9959181878b406fbc5d51ba17f2f0e6a /drivers | |
parent | fa1ac1406a0836c352dbf321a2429ba58dfcd51c (diff) |
USB: gadget: f_mtp: Fix bug in receive_file work
If cable is disconnected while receive_file work is in progress,
there is a case where mtp driver returns -ECANCELLED instead of
-EIO. This results in mtp server thread not getting disconnect
notification and mtp release will not be called. Due to this, mtp
server will not start mtp connection after next USB connection.
Change-Id: I909bebe0d22c19329cebb0a4a76424e08c82328c
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/function/f_mtp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/f_mtp.c b/drivers/usb/gadget/function/f_mtp.c index f63ab883c5b9..ab33028e2b82 100644 --- a/drivers/usb/gadget/function/f_mtp.c +++ b/drivers/usb/gadget/function/f_mtp.c @@ -930,7 +930,10 @@ static void receive_file_work(struct work_struct *data) dev->rx_done || dev->state != STATE_BUSY); if (dev->state == STATE_CANCELED || dev->state == STATE_OFFLINE) { - r = -ECANCELED; + if (dev->state == STATE_OFFLINE) + r = -EIO; + else + r = -ECANCELED; if (!dev->rx_done) usb_ep_dequeue(dev->ep_out, read_req); break; |