Merge branch 'master' of git://git.denx.de/u-boot-sh
[platform/kernel/u-boot.git] / env / common.c
index 324502e..bd340fe 100644 (file)
@@ -23,7 +23,10 @@ DECLARE_GLOBAL_DATA_PTR;
 #include <env_default.h>
 
 struct hsearch_data env_htab = {
+#if CONFIG_IS_ENABLED(ENV_SUPPORT)
+       /* defined in flags.c, only compile with ENV_SUPPORT */
        .change_ok = env_flags_validate,
+#endif
 };
 
 /*
@@ -225,7 +228,9 @@ void env_relocate(void)
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
        env_reloc();
        env_fix_drivers();
-       env_htab.change_ok += gd->reloc_off;
+
+       if (env_htab.change_ok)
+               env_htab.change_ok += gd->reloc_off;
 #endif
        if (gd->env_valid == ENV_INVALID) {
 #if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD)