[U-Boot] [PATCH] env_sf - Do not free flash environment on successful read

Oliver Dillinger oliver.dillinger at ttcontrol.com
Fri Oct 22 12:20:02 CEST 2010


In env_relocate_spec(), env_flash is freed and set to NULL
if CONFIG_ENV_OFFSET_REDUND is undefined. This leads to an
"Environment SPI flash not initialized" error when
performing a saveenv.

br,
Oliver

diff --git a/common/env_sf.c b/common/env_sf.c
index fb0c39b..fc5f9f3 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -384,7 +384,10 @@ void env_relocate_spec(void)
        ret = env_import(buf, 1);

        if (ret)
+       {
            gd->env_valid = 1;
+           return;
+       }
 out:
        spi_flash_free(env_flash);
        env_flash = NULL;




More information about the U-Boot mailing list