diff options
-rw-r--r-- | common/board_f.c | 12 | ||||
-rw-r--r-- | common/dlmalloc.c | 11 | ||||
-rw-r--r-- | include/malloc.h | 3 |
3 files changed, 15 insertions, 11 deletions
diff --git a/common/board_f.c b/common/board_f.c index 90f3b8847f2..322e0700d73 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -23,6 +23,7 @@ #include <i2c.h> #include <initcall.h> #include <logbuff.h> +#include <malloc.h> #include <mapmem.h> /* TODO: Can we move these into arch/ headers? */ @@ -721,17 +722,6 @@ static int mark_bootstage(void) return 0; } -static int initf_malloc(void) -{ -#ifdef CONFIG_SYS_MALLOC_F_LEN - assert(gd->malloc_base); /* Set up by crt0.S */ - gd->malloc_limit = gd->malloc_base + CONFIG_SYS_MALLOC_F_LEN; - gd->malloc_ptr = 0; -#endif - - return 0; -} - static int initf_dm(void) { #if defined(CONFIG_DM) && defined(CONFIG_SYS_MALLOC_F_LEN) diff --git a/common/dlmalloc.c b/common/dlmalloc.c index b2ce063c5f4..b5bb05191c2 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -3261,6 +3261,17 @@ int mALLOPt(param_number, value) int param_number; int value; } } +int initf_malloc(void) +{ +#ifdef CONFIG_SYS_MALLOC_F_LEN + assert(gd->malloc_base); /* Set up by crt0.S */ + gd->malloc_limit = CONFIG_SYS_MALLOC_F_LEN; + gd->malloc_ptr = 0; +#endif + + return 0; +} + /* History: diff --git a/include/malloc.h b/include/malloc.h index 5df634873f1..f4da9e6dddb 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -906,6 +906,9 @@ void *realloc_simple(void *ptr, size_t size); #endif +/* Set up pre-relocation malloc() ready for use */ +int initf_malloc(void); + /* Public routines */ /* Simple versions which can be used when space is tight */ |