From: Bo Shen Date: Wed, 16 Oct 2013 09:26:38 +0000 (+0800) Subject: usb: dfu: correct dfu buffer inited value X-Git-Url: http://git.dujemihanovic.xyz/img/static/gitweb.css?a=commitdiff_plain;h=31bae4c5d9e5e7eca70d64152441bc8290016560;p=u-boot.git usb: dfu: correct dfu buffer inited value After dfu buffer is initialized, the buffer should be all available, while not 0. Initialize its value to min(dfu_buf_size, dfu->r_left). Signed-off-by: Bo Shen Tested-by: Lukasz Majewski Acked-by: Lukasz Majewski --- diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c index cccc04417a..1eb92e5417 100644 --- a/drivers/dfu/dfu.c +++ b/drivers/dfu/dfu.c @@ -288,7 +288,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num) dfu->offset = 0; dfu->i_buf_end = dfu_get_buf() + dfu_buf_size; dfu->i_buf = dfu->i_buf_start; - dfu->b_left = 0; + dfu->b_left = min(dfu_buf_size, dfu->r_left); dfu->bad_skip = 0;