]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/env_sf.c
Merge branch 'master' of git://git.denx.de/u-boot-arm into master
[karo-tx-uboot.git] / common / env_sf.c
index 9f806fb090f54964566bc5bd4fef89068d0a4222..be270f21bcf6577ae44bd1d394817c5eb609fb01 100644 (file)
@@ -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