summaryrefslogtreecommitdiff
path: root/drivers/dfu
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2013-11-08 15:25:29 -0500
committerTom Rini <trini@ti.com>2013-11-08 15:25:29 -0500
commit15c5cdf5aa6b292145e5e3e220ec1f42b11eff6f (patch)
tree662fecd9e66cfe485097f777912824d81f9642e6 /drivers/dfu
parent28c860b23fb2dd1affec909e98f25c58324e2140 (diff)
parent47d79deb996797dddd0984cef8b48a566c82180e (diff)
downloadu-boot-imx-15c5cdf5aa6b292145e5e3e220ec1f42b11eff6f.zip
u-boot-imx-15c5cdf5aa6b292145e5e3e220ec1f42b11eff6f.tar.gz
u-boot-imx-15c5cdf5aa6b292145e5e3e220ec1f42b11eff6f.tar.bz2
Merge branch 'master' of git://www.denx.de/git/u-boot-usb
Diffstat (limited to 'drivers/dfu')
-rw-r--r--drivers/dfu/dfu.c3
-rw-r--r--drivers/dfu/dfu_nand.c1
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 4a8804e..1eb92e5 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -229,6 +229,7 @@ static int dfu_read_buffer_fill(struct dfu_entity *dfu, void *buf, int size)
dfu->crc = crc32(dfu->crc, buf, chunk);
dfu->i_buf += chunk;
dfu->b_left -= chunk;
+ dfu->r_left -= chunk;
size -= chunk;
buf += chunk;
readn += chunk;
@@ -287,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;
diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index edbf5a9..2d07097 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -121,6 +121,7 @@ static int dfu_read_medium_nand(struct dfu_entity *dfu, u64 offset, void *buf,
switch (dfu->layout) {
case DFU_RAW_ADDR:
+ *len = dfu->data.nand.size;
ret = nand_block_read(dfu, offset, buf, len);
break;
default: