public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v1] usb: gadget: f_dfu: write req->actual bytes
@ 2017-02-10 16:32 Andy Shevchenko
  2017-02-10 17:50 ` Marek Vasut
  0 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2017-02-10 16:32 UTC (permalink / raw)
  To: u-boot

From: Felipe Balbi <felipe.balbi@linux.intel.com>

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>
---
 drivers/usb/gadget/f_dfu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index 8e7c981657..64cdfa7c98 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;
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-02-22  9:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <de749db9-9d5c-4777-b4e9-2c0dd1840cb8@email.android.com>
2017-02-13 11:42 ` [U-Boot] [PATCH v1] usb: gadget: f_dfu: write req->actual bytes Felipe Balbi
2017-02-13 13:41   ` Lukasz Majewski
2017-02-13 15:02     ` Andy Shevchenko
2017-02-21 11:17     ` Felipe Balbi
2017-02-21 11:58       ` Lukasz Majewski
2017-02-21 12:58         ` Felipe Balbi
2017-02-21 13:21           ` Lukasz Majewski
2017-02-21 15:46             ` Felipe Balbi
2017-02-21 22:31               ` Lukasz Majewski
2017-02-22  9:21                 ` Felipe Balbi
2017-02-10 16:32 Andy Shevchenko
2017-02-10 17:50 ` Marek Vasut
2017-02-13 10:42   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox