Dear Alessandro Rubini,

In message <20090719163317.ga18...@mail.gnudd.com> you wrote:
> From: Alessandro Rubini <rub...@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 <rub...@gnudd.com>

Yes, I ran into this myself, too. Unfortunaltely I must have
overlooked these ARM error messages when I tested commit 5669ed45
("cmd_flash.c: fix warning: unused variable 'addr_first'/'addr_last'").

Instead of adding another declaration for these variables as you are
doing here, I prefer to change the #ifdef mess^H^H^H^Hlogic earlier in
the file:


>From 567d30367322b6aa76f788ce33ac224e4f1a94da Mon Sep 17 00:00:00 2001
From: Wolfgang Denk <w...@denx.de>
Date: Sun, 19 Jul 2009 19:32:37 +0200
Subject: [PATCH] cmd_flash.c: fix fix compile error for boards with DataFlash

Commit 5669ed45 ("cmd_flash.c: fix warning: unused variable
'addr_first'/'addr_last'") changed the #ifdef logic areound the
declaration of these variables and missed a combination of settings
of HAS_DATAFLASH with SYS_NO_FLASH; this patch fixes this.

Also spotted by Alessandro Rubini <rub...@gnudd.com>

Signed-off-by: Wolfgang Denk <w...@denx.de>
---
 common/cmd_flash.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/common/cmd_flash.c b/common/cmd_flash.c
index bc651fa..3773412 100644
--- a/common/cmd_flash.c
+++ b/common/cmd_flash.c
@@ -467,8 +467,10 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char 
*argv[])
        flash_info_t *info;
        ulong bank;
        int i, n, sect_first, sect_last;
-       ulong addr_first, addr_last;
 #endif /* CONFIG_SYS_NO_FLASH */
+#if !defined(CONFIG_SYS_NO_FLASH) || defined(CONFIG_HAS_DATAFLASH)
+       ulong addr_first, addr_last;
+#endif
 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
        struct mtd_device *dev;
        struct part_info *part;
-- 
1.6.0.6


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
What about WRITING it first and rationalizing it afterwords?  :-)
                       - Larry Wall in <8...@jpl-devvax.jpl.nasa.gov>
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to