From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1] usb: gadget: f_dfu: write req->actual bytes
Date: Fri, 10 Feb 2017 19:32:31 +0300 [thread overview]
Message-ID: <20170210163231.195201-1-andriy.shevchenko@linux.intel.com> (raw)
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
next reply other threads:[~2017-02-10 16:32 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-10 16:32 Andy Shevchenko [this message]
2017-02-10 17:50 ` [U-Boot] [PATCH v1] usb: gadget: f_dfu: write req->actual bytes Marek Vasut
2017-02-13 10:42 ` Felipe Balbi
[not found] <de749db9-9d5c-4777-b4e9-2c0dd1840cb8@email.android.com>
2017-02-13 11:42 ` 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170210163231.195201-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox