From: Felipe Balbi Date: Fri, 10 Feb 2017 16:32:31 +0000 (+0300) Subject: usb: gadget: f_dfu: write req->actual bytes X-Git-Tag: v2017.03-rc3~7^2~2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=00e9d69629eb026a2ccc9e2526e365b1e796a14d;p=oweals%2Fu-boot.git 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 Signed-off-by: Andy Shevchenko --- diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c index 26b3e6e8b8..81929d3e0d 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;