mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: David Dgien <dgienda125@gmail.com>, Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] malloc: make malloc_add_pool return void
Date: Mon,  5 Jan 2026 09:22:33 +0100	[thread overview]
Message-ID: <20260105082234.3248830-1-a.fatoum@barebox.org> (raw)

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 <dgienda125@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 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




             reply	other threads:[~2026-01-05  8:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  8:22 Ahmad Fatoum [this message]
2026-01-06  7:41 ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260105082234.3248830-1-a.fatoum@barebox.org \
    --to=a.fatoum@barebox.org \
    --cc=barebox@lists.infradead.org \
    --cc=dgienda125@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox