From a161800214d7409f6e996b143974511d3d0fdc2e Mon Sep 17 00:00:00 2001 From: dongjiuzhu1 Date: Sun, 30 Oct 2022 17:39:15 +0800 Subject: [PATCH] mm/mm_heap: do this check in mm_size2ndx Signed-off-by: dongjiuzhu1 --- mm/mm_heap/mm_malloc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/mm/mm_heap/mm_malloc.c b/mm/mm_heap/mm_malloc.c index f840f629ea..e2f57fb83c 100644 --- a/mm/mm_heap/mm_malloc.c +++ b/mm/mm_heap/mm_malloc.c @@ -147,20 +147,9 @@ FAR void *mm_malloc(FAR struct mm_heap_s *heap, size_t size) DEBUGVERIFY(mm_lock(heap)); - /* Get the location in the node list to start the search. Special case - * really big allocations - */ + /* Convert the request size into a nodelist index */ - if (alignsize >= MM_MAX_CHUNK) - { - ndx = MM_NNODES - 1; - } - else - { - /* Convert the request size into a nodelist index */ - - ndx = mm_size2ndx(alignsize); - } + ndx = mm_size2ndx(alignsize); /* Search for a large enough chunk in the list of nodes. This list is * ordered by size, but will have occasional zero sized nodes as we visit