diff options
author | Ying Zhang <b40530@freescale.com> | 2014-01-24 15:50:07 +0800 |
---|---|---|
committer | York Sun <yorksun@freescale.com> | 2014-02-24 15:23:19 -0800 |
commit | 5a89fa927cf6c54efe36918a4894ce31274d9ef1 (patch) | |
tree | 5667df81a516e0605b1d77236dcf5595424cbcbb /common/env_sf.c | |
parent | ee4d65117d49db094451f2943944777761e9cfad (diff) | |
download | u-boot-imx-5a89fa927cf6c54efe36918a4894ce31274d9ef1.zip u-boot-imx-5a89fa927cf6c54efe36918a4894ce31274d9ef1.tar.gz u-boot-imx-5a89fa927cf6c54efe36918a4894ce31274d9ef1.tar.bz2 |
SPL: P2020RDB: fix the problem booting from spi flash
There was no enough stack in SPL, so the buffer needed in SPL is to malloc
from memory pool and to repalce the temporary variable.
Signed-off-by: Ying Zhang <b40530@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
Diffstat (limited to 'common/env_sf.c')
-rw-r--r-- | common/env_sf.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/env_sf.c b/common/env_sf.c index 9f806fb..be270f2 100644 --- a/common/env_sf.c +++ b/common/env_sf.c @@ -299,13 +299,16 @@ int saveenv(void) void env_relocate_spec(void) { - char buf[CONFIG_ENV_SIZE]; int ret; + char *buf = NULL; + buf = (char *)malloc(CONFIG_ENV_SIZE); env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); if (!env_flash) { set_default_env("!spi_flash_probe() failed"); + if (buf) + free(buf); return; } @@ -321,6 +324,8 @@ void env_relocate_spec(void) gd->env_valid = 1; out: spi_flash_free(env_flash); + if (buf) + free(buf); env_flash = NULL; } #endif |