Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-sunxi
[oweals/u-boot.git] / common / spl / spl_fat.c
index 0403016bb433c7bdb2299bdcc215204c6cb6bcec..c2eb097365ffbea29c16610d305c3e44d6d1107d 100644 (file)
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <env.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/u-boot.h>
 #include <fat.h>
@@ -63,8 +65,7 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
        if (err)
                goto end;
 
-       header = (struct image_header *)(CONFIG_SYS_TEXT_BASE -
-                                               sizeof(struct image_header));
+       header = spl_get_load_buffer(-sizeof(*header), sizeof(*header));
 
        err = file_fat_read(filename, header, sizeof(struct image_header));
        if (err <= 0)