[U-Boot] [PATCH 03/10] board_init_f_mem(): Round down for stack alignment

Simon Glass sjg at chromium.org
Thu Apr 16 03:14:02 CEST 2015


We have plenty of stack space for this little function, but just to be safe,
round the stack pointer down instead of up. This may also reduce confusion
for later readers of the code.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 common/init/global_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/init/global_data.c b/common/init/global_data.c
index ef055c4..d2d7baa 100644
--- a/common/init/global_data.c
+++ b/common/init/global_data.c
@@ -19,7 +19,7 @@ ulong board_init_f_mem(ulong top)
 	top -= 0x40;
 
 	top -= sizeof(struct global_data);
-	top = ALIGN(top, 16);
+	top = round_down(top, 16);
 	gd = (struct global_data *)top;
 #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT)
 	memset((void *)gd, '\0', sizeof(*gd));
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list