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

Sean Anderson sean.anderson at seco.com
Thu Sep 28 16:44:55 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>
Reviewed-by: Simon Glass <sjg at chromium.org>
---

(no changes since v2)

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 52786901be5..cd1e5a3a4c7 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;
 }
@@ -204,6 +204,7 @@ static int initr_malloc(void)
 	gd_set_malloc_start(start);
 	mem_malloc_init((ulong)map_sysmem(start, TOTAL_MALLOC_LEN),
 			TOTAL_MALLOC_LEN);
+	gd->flags |= GD_FLG_FULL_MALLOC_INIT;
 	return 0;
 }
 
-- 
2.35.1.1320.gc452695387.dirty



More information about the U-Boot mailing list