summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2017-02-10 19:32:31 +0300
committerMarek Vasut <marex@denx.de>2017-02-26 13:24:30 +0100
commit00e9d69629eb026a2ccc9e2526e365b1e796a14d (patch)
tree6e860828fe5307e20c0efd08db281f2fe53fb1de
parentd428776657154f57b89913ffb0c5a23cb5b595f7 (diff)
downloadu-boot-imx-00e9d69629eb026a2ccc9e2526e365b1e796a14d.zip
u-boot-imx-00e9d69629eb026a2ccc9e2526e365b1e796a14d.tar.gz
u-boot-imx-00e9d69629eb026a2ccc9e2526e365b1e796a14d.tar.bz2
usb: gadget: f_dfu: write req->actual bytes
If last packet is short, we shouldn't write req->length bytes to non-volatile media, we should write only what's available to us, which is held in req->actual. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r--drivers/usb/gadget/f_dfu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 26b3e6e..81929d3 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -159,7 +159,7 @@ static void dnload_request_complete(struct usb_ep *ep, struct usb_request *req)
int ret;
ret = dfu_write(dfu_get_entity(f_dfu->altsetting), req->buf,
- req->length, f_dfu->blk_seq_num);
+ req->actual, f_dfu->blk_seq_num);
if (ret) {
f_dfu->dfu_status = DFU_STATUS_errUNKNOWN;
f_dfu->dfu_state = DFU_STATE_dfuERROR;