Fix problem with default #defines
authorwdenk <wdenk>
Thu, 6 Mar 2003 14:23:06 +0000 (14:23 +0000)
committerwdenk <wdenk>
Thu, 6 Mar 2003 14:23:06 +0000 (14:23 +0000)
Cleanup compiler warning

common/env_flash.c
include/environment.h

index 19e2282643d8227fa3c96dbad7b0ead3815b0bbe..426d01b19bef3306b1b38f8377c4101406052d26 100644 (file)
@@ -160,9 +160,11 @@ int  env_init(void)
 #ifdef CMD_SAVEENV
 int saveenv(void)
 {
+       char *saved_data = NULL;
        int rc = 1;
+#if CFG_ENV_SECT_SIZE > CFG_ENV_SIZE
        ulong up_data = 0;
-       char *saved_data = NULL;
+#endif
 
        debug ("Protect off %08lX ... %08lX\n",
                (ulong)flash_addr, end_addr);
index fe8465b9606e589f7c129a56c99292a5c1ffed01..bb109649f6bab7492ba9242d64fc43784c8ed2ab 100644 (file)
 # if !defined(CFG_ENV_ADDR_REDUND) && defined(CFG_ENV_OFFSET_REDUND)
 #  define CFG_ENV_ADDR_REDUND  (CFG_FLASH_BASE + CFG_ENV_OFFSET_REDUND)
 # endif
-# ifndef  CFG_ENV_SIZE
-#  define CFG_ENV_SIZE CFG_ENV_SECT_SIZE
+# if defined(CFG_ENV_SECT_SIZE) || defined(CFG_ENV_SIZE)
+#  ifndef  CFG_ENV_SECT_SIZE
+#   define CFG_ENV_SECT_SIZE   CFG_ENV_SIZE
+#  endif
+#  ifndef  CFG_ENV_SIZE
+#   define CFG_ENV_SIZE        CFG_ENV_SECT_SIZE
+#  endif
+# else
+#  error "Both CFG_ENV_SECT_SIZE and CFG_ENV_SIZE undefined"
 # endif
 # if defined(CFG_ENV_ADDR_REDUND) && !defined(CFG_ENV_SIZE_REDUND)
 #  define CFG_ENV_SIZE_REDUND  CFG_ENV_SIZE