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>
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 2270a61..5d504df 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -89,7 +89,7 @@
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");