This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 39a81844d8f74b16b40092f0962e3f81d80a3f8c Author: Marco Casaroli <[email protected]> AuthorDate: Fri Oct 30 07:56:21 2026 +0100 mm/tlsf: Fix the nxstyle errors. Add the missing blank lines after declarations and fix the indentation of two blocks. The errors are older than this change. No code change: "git diff -w --ignore-blank-lines" is empty. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- mm/tlsf/mm_tlsf.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/mm/tlsf/mm_tlsf.c b/mm/tlsf/mm_tlsf.c index f5c44a20d24..957ce1e10b0 100644 --- a/mm/tlsf/mm_tlsf.c +++ b/mm/tlsf/mm_tlsf.c @@ -261,6 +261,7 @@ static int memdump_record_comare(FAR const void *a, FAR const void *b) FAR struct mm_tlsf_node_s *node_b = (FAR struct mm_tlsf_node_s *)b; size_t size_a = node_a->size; size_t size_b = node_b->size; + return size_a > size_b ? 1 : -1; } @@ -294,6 +295,7 @@ static void memdump_record_biggest(FAR struct mm_memdump_priv_s *priv, static void memdump_dump_biggestnodes(FAR struct mm_memdump_priv_s *priv) { size_t i; + for (i = 0; i < priv->filled; i++) { priv->info.uordblks += priv->node[i].size; @@ -328,6 +330,7 @@ static void memdump_backtrace(FAR struct mm_heap_s *heap, int ret = sched_backtrace(buf->pid, buf->backtrace, CONFIG_MM_BACKTRACE, CONFIG_MM_BACKTRACE_SKIP); + if (ret < CONFIG_MM_BACKTRACE) { buf->backtrace[ret] = NULL; @@ -641,20 +644,21 @@ static void mm_delayfree(FAR struct mm_heap_s *heap, FAR void *mem, if (mm_lock(heap) == 0) { size_t size = mm_malloc_size(heap, mem); + UNUSED(size); #ifdef CONFIG_MM_FILL_ALLOCATIONS #if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0 - /* If delay free is enabled, a memory node will be freed twice. - * The first time is to add the node to the delay list, and the second - * time is to actually free the node. Therefore, we only colorize the - * memory node the first time, when `delay` is set to true. - */ + /* If delay free is enabled, a memory node will be freed twice. + * The first time is to add the node to the delay list, and the second + * time is to actually free the node. Therefore, we only colorize the + * memory node the first time, when `delay` is set to true. + */ - if (delay) + if (delay) #endif - { - memset(mem, MM_FREE_MAGIC, size); - } + { + memset(mem, MM_FREE_MAGIC, size); + } #endif kasan_poison(mem, size); @@ -1348,6 +1352,7 @@ size_t mm_malloc_size(FAR struct mm_heap_s *heap, FAR void *mem) if (heap->mm_mpool) { ssize_t size = mempool_multiple_alloc_size(heap->mm_mpool, mem); + if (size >= 0) { return size; @@ -1653,6 +1658,7 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem, { #if CONFIG_MM_BACKTRACE >= 0 FAR struct memdump_backtrace_s *buf = newmem + newsize; + memdump_backtrace(heap, buf); #endif } @@ -1729,7 +1735,7 @@ FAR void *mm_zalloc(FAR struct mm_heap_s *heap, size_t size) if (alloc) { - memset(alloc, 0, size); + memset(alloc, 0, size); } return alloc;
