There is no common semantics for how the result of the function is interpreted and there are no users that make use of it, so turn it to return void.
Cc: David Dgien <[email protected]> Signed-off-by: Ahmad Fatoum <[email protected]> --- common/tlsf_malloc.c | 10 ++++------ include/malloc.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/common/tlsf_malloc.c b/common/tlsf_malloc.c index 7de39ebeef09..36fdc307cc26 100644 --- a/common/tlsf_malloc.c +++ b/common/tlsf_malloc.c @@ -105,13 +105,13 @@ void malloc_stats(void) printf("used: %zu\nfree: %zu\n", s.used, s.free); } -void *malloc_add_pool(void *mem, size_t bytes) +void malloc_add_pool(void *mem, size_t bytes) { pool_t new_pool; struct pool_entry *new_pool_entry; if (!mem) - return NULL; + return; if (!tlsf_mem_pool) { tlsf_mem_pool = tlsf_create(mem); @@ -121,16 +121,14 @@ void *malloc_add_pool(void *mem, size_t bytes) new_pool = tlsf_add_pool(tlsf_mem_pool, mem, bytes); if (!new_pool) - return NULL; + return; new_pool_entry = malloc(sizeof(*new_pool_entry)); if (!new_pool_entry) - return NULL; + return; new_pool_entry->pool = new_pool; list_add(&new_pool_entry->list, &mem_pool_list); - - return (void *)new_pool; } static void tlsf_request_store(tlsf_t tlsf, size_t bytes) diff --git a/include/malloc.h b/include/malloc.h index bee998cd9079..82fa2bb39c8e 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -22,12 +22,12 @@ (unsigned long)ZERO_SIZE_PTR) #ifdef CONFIG_MALLOC_TLSF -void *malloc_add_pool(void *mem, size_t bytes); +void malloc_add_pool(void *mem, size_t bytes); void malloc_register_store(void (*cb)(size_t bytes)); bool malloc_store_is_registered(void); #else #include <linux/bug.h> -static inline void *malloc_add_pool(void *mem, size_t bytes) { BUG(); } +static inline void malloc_add_pool(void *mem, size_t bytes) { BUG(); } static inline void malloc_register_store(void (*cb)(size_t bytes)) { BUG(); } static inline bool malloc_store_is_registered(void) { return false; } #endif -- 2.47.3
