dfu:usb:fix: Read the "filesize" environment variable only when file read
authorŁukasz Majewski <l.majewski@samsung.com>
Thu, 23 Aug 2012 23:33:56 +0000 (23:33 +0000)
committerMarek Vasut <marex@denx.de>
Thu, 20 Sep 2012 22:05:00 +0000 (00:05 +0200)
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>
drivers/dfu/dfu_mmc.c

index 2270a61..5d504df 100644 (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");