image: fix getenv_bootm_size() function
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Fri, 18 Dec 2015 05:17:10 +0000 (14:17 +0900)
committerTom Rini <trini@konsulko.com>
Tue, 19 Jan 2016 13:31:11 +0000 (08:31 -0500)
Currently, this function returns wrong size if "bootm_low" is defined,
but "bootm_size" is not.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/image.c

index d63d9e016986f8931312c3708d97ffc45b53b99f..f4a1dc8e251a24251d5a09e0e900360d4fb846bb 100644 (file)
@@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void)
 
 
 #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
-       return gd->bd->bi_dram[0].size - tmp;
+       return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
 #else
-       return gd->bd->bi_memsize - tmp;
+       return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart);
 #endif
 }