[PATCH v2 1/4] common: Only mark malloc initialized after mem_malloc_init

Sean Anderson sean.anderson at seco.com
Wed Aug 9 00:53:17 CEST 2023


Instead of marking malloc as initialized as soon as relocation is done,
defer it until after we call mem_malloc_init. This ensures that malloc
initialization is done before we switch away from simple_malloc, and
matches the SPL behavior.

Fixes: c9356be3074 ("dm: Split the simple malloc() implementation into its own file")
Signed-off-by: Sean Anderson <sean.anderson at seco.com>
---

Changes in v2:
- New

 common/board_r.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/board_r.c b/common/board_r.c
index d798c00a80a..58a5986aa54 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -98,7 +98,7 @@ static int initr_trace(void)
 static int initr_reloc(void)
 {
 	/* tell others: relocation done */
-	gd->flags |= GD_FLG_RELOC | GD_FLG_FULL_MALLOC_INIT;
+	gd->flags |= GD_FLG_RELOC;
 
 	return 0;
 }
@@ -210,6 +210,7 @@ static int initr_malloc(void)
 	malloc_start = gd->relocaddr - TOTAL_MALLOC_LEN;
 	mem_malloc_init((ulong)map_sysmem(malloc_start, TOTAL_MALLOC_LEN),
 			TOTAL_MALLOC_LEN);
+	gd->flags |= GD_FLG_FULL_MALLOC_INIT;
 	return 0;
 }
 
-- 
2.25.1



More information about the U-Boot mailing list