summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorBo Shen <voice.shen@atmel.com>2013-10-16 09:26:38 (GMT)
committerMarek Vasut <marex@denx.de>2013-11-08 19:46:20 (GMT)
commit31bae4c5d9e5e7eca70d64152441bc8290016560 (patch)
tree991494b43f261a2a3ad3989225edba522330e9ac /drivers
parentc2617bc77323e75f68cc7aa6ce54bf39771f1e7a (diff)
downloadu-boot-31bae4c5d9e5e7eca70d64152441bc8290016560.tar.xz
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 <voice.shen@atmel.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dfu/dfu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index cccc044..1eb92e5 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;