saveenv: spi-nor: fix for data abort issue

This changes update env_flash variable to currently updated memory location
by sf probe. So this will avoid accessing of outdated memory location.

Signed-off-by: Vandhiadevan Karunamoorthy <vkarunam@codeaurora.org>
Change-Id: Ib97c485f3c738d5501ee1cdb62c5ebbf421e8d14
This commit is contained in:
Vandhiadevan Karunamoorthy 2020-08-04 20:01:42 +05:30
parent e0fdbf3dfb
commit 465a58cc6b

View file

@ -52,7 +52,6 @@ int sf_saveenv(void)
u32 saved_size, saved_offset, sector = 1;
int ret;
if (!env_flash) {
env_flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
CONFIG_SF_DEFAULT_CS,
CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE);
@ -60,7 +59,6 @@ int sf_saveenv(void)
set_default_env("!spi_flash_probe() failed");
return 1;
}
}
ret = env_export(&env_new);
if (ret)
@ -226,7 +224,6 @@ int sf_saveenv(void)
int ret = 1;
env_t env_new;
if (!env_flash) {
env_flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
CONFIG_SF_DEFAULT_CS,
CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE);
@ -234,7 +231,6 @@ int sf_saveenv(void)
set_default_env("!spi_flash_probe() failed");
return 1;
}
}
/* Is the sector larger than the env (i.e. embedded) */
if (CONFIG_ENV_SECT_SIZE > CONFIG_ENV_RANGE) {