From: Mike Frysinger <vapier@gentoo.org>
Date: Mon, 6 Oct 2008 07:57:39 +0000 (-0400)
Subject: Blackfin: respect/check CONFIG_SYS_GBL_DATA_SIZE
X-Git-Tag: v2025.01-rc5-pxa1908~21557^2~24
X-Git-Url: http://git.dujemihanovic.xyz/html/static/gitweb.css?a=commitdiff_plain;h=78a0ba7dc24c9682371f6ee8549b569fb573a329;p=u-boot.git

Blackfin: respect/check CONFIG_SYS_GBL_DATA_SIZE

When setting up the global data, rather than relying on sizeof(), use the
common CONFIG_SYS_GBL_DATA_SIZE define.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---

diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index dcf246d6ce..fef1934d6f 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -279,9 +279,13 @@ void board_init_f(ulong bootflag)
 	dcache_enable();
 #endif
 
+#ifdef DEBUG
+	if (CONFIG_SYS_GBL_DATA_SIZE < sizeof(*gd))
+		hang();
+#endif
 	serial_early_puts("Init global data\n");
 	gd = (gd_t *) (CONFIG_SYS_GBL_DATA_ADDR);
-	memset((void *)gd, 0, sizeof(gd_t));
+	memset((void *)gd, 0, CONFIG_SYS_GBL_DATA_SIZE);
 
 	/* Board data initialization */
 	addr = (CONFIG_SYS_GBL_DATA_ADDR + sizeof(gd_t));