From: Mike Lockwood Date: Mon, 15 Nov 2010 20:22:21 +0000 (-0500) Subject: USB: gadget: f_mtp: Return zero result for successful file transfer. X-Git-Tag: firefly_0821_release~7613^2~796 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=76ac65501829684f281b5ad79b7f730b86c335c7;p=firefly-linux-kernel-4.4.55.git USB: gadget: f_mtp: Return zero result for successful file transfer. Returning number of bytes transfered does not work for files > 2 gig since ioctl() result is a signed integer. Signed-off-by: Mike Lockwood --- diff --git a/drivers/usb/gadget/f_mtp.c b/drivers/usb/gadget/f_mtp.c index 81075f2bf080..81cc01868397 100644 --- a/drivers/usb/gadget/f_mtp.c +++ b/drivers/usb/gadget/f_mtp.c @@ -621,15 +621,16 @@ static void send_file_work(struct work_struct *data) { struct file *filp; loff_t offset; size_t count; - int r, xfer, ret; + int xfer, ret; + int r = 0; /* read our parameters */ smp_rmb(); filp = dev->xfer_file; offset = dev->xfer_file_offset; - r = count = dev->xfer_file_length; + count = dev->xfer_file_length; - DBG(cdev, "send_file_work(%lld %d)\n", offset, count); + DBG(cdev, "send_file_work(%lld %u)\n", offset, count); while (count > 0) { /* get an idle tx request to use */ @@ -686,15 +687,16 @@ static void receive_file_work(struct work_struct *data) struct file *filp; loff_t offset; size_t count; - int r, ret, cur_buf = 0; + int ret, cur_buf = 0; + int r = 0; /* read our parameters */ smp_rmb(); filp = dev->xfer_file; offset = dev->xfer_file_offset; - r = count = dev->xfer_file_length; + count = dev->xfer_file_length; - DBG(cdev, "receive_file_work(%d)\n", count); + DBG(cdev, "receive_file_work(%u)\n", count); while (count > 0 || write_req) { if (count > 0) {