From: Masahiro Yamada <yamada.masahiro@socionext.com>
Date: Fri, 18 Dec 2015 05:17:10 +0000 (+0900)
Subject: image: fix getenv_bootm_size() function
X-Git-Tag: v2025.01-rc5-pxa1908~10698
X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/git-favicon.png?a=commitdiff_plain;h=9c11135ce053;p=u-boot.git

image: fix getenv_bootm_size() function

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>
---

diff --git a/common/image.c b/common/image.c
index d63d9e0169..f4a1dc8e25 100644
--- a/common/image.c
+++ b/common/image.c
@@ -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
 }