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

Wolfgang Denk wd at denx.de
Fri Oct 22 12:56:19 CEST 2010


Dear Oliver Dillinger,

In message <loom.20101022T120849-268 at post.gmane.org> you wrote:
> 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

Signed-off-by: line missing.

Please read http://www.denx.de/wiki/U-Boot/Patches


> 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)
> +       {

Incorrect brace style.

>             gd->env_valid = 1;
> +           return;

Your patch is white-space corrupted.



Also, this patch is not correct. It is OK to call spi_flash_free()
here.


The bug is in saveenv() for the non-redundant case. The function has
not been dapted to the new environment code, at all; for example, it
fails to actually export the internally stored environment [there is
no call to hexport()].

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: wd at denx.de
"I think they're going to take all this money that we  spend  now  on
war and death --"                   "And make them spend it on life."
	-- Edith Keeler and Kirk, "The City on the Edge of Forever",
	   stardate unknown.


More information about the U-Boot mailing list