From 29cdf66e1ae8ffb358a065820c99b069693f312d Mon Sep 17 00:00:00 2001 From: ligd Date: Mon, 29 Mar 2021 21:36:46 +0800 Subject: [PATCH] mm/mm_heap: fix compile failed when open DEBUG_MM Change-Id: Id21e9619e4800ec9f02f818ec86d80cdd99d9aae Signed-off-by: ligd --- mm/mm_heap/mm_checkcorruption.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/mm/mm_heap/mm_checkcorruption.c b/mm/mm_heap/mm_checkcorruption.c index c4ae135d0e..5bafdbae0c 100644 --- a/mm/mm_heap/mm_checkcorruption.c +++ b/mm/mm_heap/mm_checkcorruption.c @@ -31,6 +31,8 @@ #include #include +#include "mm_heap/mm.h" + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -45,8 +47,13 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap) { + FAR struct mm_heap_impl_s *heap_impl; FAR struct mm_allocnode_s *node; FAR struct mm_allocnode_s *prev; + + DEBUGASSERT(MM_IS_VALID(heap)); + heap_impl = heap->mm_impl; + #if CONFIG_MM_REGIONS > 1 int region; #else @@ -56,7 +63,7 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap) /* Visit each region */ #if CONFIG_MM_REGIONS > 1 - for (region = 0; region < heap->mm_nregions; region++) + for (region = 0; region < heap_impl->mm_nregions; region++) #endif { irqstate_t flags = 0; @@ -69,7 +76,7 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap) if (up_interrupt_context() || sched_idletask()) { - if (heap->mm_counts_held) + if (heap_impl->mm_counts_held) { #if CONFIG_MM_REGIONS > 1 continue; @@ -85,8 +92,8 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap) mm_takesemaphore(heap); } - for (node = heap->mm_heapstart[region]; - node < heap->mm_heapend[region]; + for (node = heap_impl->mm_heapstart[region]; + node < heap_impl->mm_heapend[region]; node = (FAR struct mm_allocnode_s *) ((FAR char *)node + node->size)) { @@ -113,7 +120,7 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap) prev = node; } - assert(node == heap->mm_heapend[region]); + assert(node == heap_impl->mm_heapend[region]); if (up_interrupt_context() || sched_idletask()) {