dfu:usb:fix: Read the "filesize" environment variable only when file read

The "filesize" environment variable shall be read only when relevant
file is read.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Marek Vasut <marex@denx.de>
This commit is contained in:
Łukasz Majewski 2012-08-23 23:33:56 +00:00 committed by Marek Vasut
parent 43e6627259
commit 81c1d7b605

View file

@ -89,7 +89,7 @@ static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu,
return ret;
}
if (dfu->layout != DFU_RAW_ADDR) {
if (dfu->layout != DFU_RAW_ADDR && op == DFU_OP_READ) {
str_env = getenv("filesize");
if (str_env == NULL) {
puts("dfu: Wrong file size!\n");