[U-Boot] [PATCH v1] usb: gadget: f_dfu: write req->actual bytes

Marek Vasut marex at denx.de
Fri Feb 10 17:50:20 UTC 2017


On 02/10/2017 05:32 PM, Andy Shevchenko wrote:
> From: Felipe Balbi <felipe.balbi at 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 at linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>

Since I have no clue about DFU internals, I will wait for Lukasz's Ack.

> ---
>  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;
> 


-- 
Best regards,
Marek Vasut


More information about the U-Boot mailing list