malloc: make malloc_add_pool return void
PATCH 1/1 malloc: make malloc_add_pool return void
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(-)
common/tlsf_malloc.c +4 -6
@@ -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)
include/malloc.h +2 -2
@@ -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
Signature · 1 line
2.47.3
Sascha Hauer
AppliedQuoted 5 lines · Ahmad Fatoum
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.
Applied, thanks!
[1/1] malloc: make malloc_add_pool return void
https://git.pengutronix.de/cgit/barebox/commit/?id=4fd334241264 (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>