]> git.sur5r.net Git - u-boot/commitdiff
usb: dfu: correct dfu buffer inited value
authorBo Shen <voice.shen@atmel.com>
Wed, 16 Oct 2013 09:26:38 +0000 (17:26 +0800)
committerMarek Vasut <marex@denx.de>
Fri, 8 Nov 2013 19:46:20 +0000 (20:46 +0100)
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 <voice.shen@atmel.com>
Tested-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
drivers/dfu/dfu.c

index cccc04417a040c7dc4f920d46e3688fc6efe5561..1eb92e54176148081491ff449ba1107f90eaf641 100644 (file)
@@ -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;