diff mbox series

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

Message ID 20230928144458.2511087-2-sean.anderson@seco.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series [v3,1/4] common: Only mark malloc initialized after mem_malloc_init | expand

Commit Message

Sean Anderson Sept. 28, 2023, 2:44 p.m. UTC
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@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

(no changes since v2)

Changes in v2:
- New

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

Patch

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;
 }