Unfortunately memset() is not always available, so provide a substitute when
needed.

Signed-off-by: Simon Glass <s...@chromium.org>
---

 common/init/global_data.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/init/global_data.c b/common/init/global_data.c
index 2633f0d..ef055c4 100644
--- a/common/init/global_data.c
+++ b/common/init/global_data.c
@@ -21,7 +21,15 @@ ulong board_init_f_mem(ulong top)
        top -= sizeof(struct global_data);
        top = ALIGN(top, 16);
        gd = (struct global_data *)top;
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT)
        memset((void *)gd, '\0', sizeof(*gd));
+#else
+       int *ptr = (int *)gd;
+       int *end = (int *)(gd + 1);
+
+       while (ptr < end)
+               *ptr++ = 0;
+#endif
 
 #ifdef CONFIG_SYS_MALLOC_F_LEN
        top -= CONFIG_SYS_MALLOC_F_LEN;
-- 
2.2.0.rc0.207.ga3a616c

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to