[U-Boot] [PATCH] cmd_flash.c: fix compile error for boards with DataFlash

Alessandro Rubini rubini-list at gnudd.com
Sun Jul 19 18:33:17 CEST 2009


From: Alessandro Rubini <rubini at gnudd.com>

The local variables addr_first and addr_last are used if HAS_DATAFLASH
even if SYS_NO_FLASH (meaning no NOR flash). This adds the definitions
withing the brace where the names are used, to avoid cluttering the
initial ifdef.

Signed-off-by: Alessandro Rubini <rubini at gnudd.com>
---

5 boards were not compiling with "./MAKEALL arm", now they all work.
Actually, even at91sam9263ek_nandflash_config was in error, but it's
not one of the MAKEALL targets. Should MAKEALL test all possible configs or not?

 common/cmd_flash.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/common/cmd_flash.c b/common/cmd_flash.c
index bc651fa..4f12bbc 100644
--- a/common/cmd_flash.c
+++ b/common/cmd_flash.c
@@ -496,6 +496,8 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 #ifdef CONFIG_HAS_DATAFLASH
 	if ((strcmp(argv[2], "all") != 0) && (strcmp(argv[2], "bank") != 0)) {
+		ulong addr_first, addr_last;
+
 		addr_first = simple_strtoul(argv[2], NULL, 16);
 		addr_last  = simple_strtoul(argv[3], NULL, 16);
 
-- 
1.6.0.2


More information about the U-Boot mailing list