mm/mm_heap: fix compile failed when open DEBUG_MM

Change-Id: Id21e9619e4800ec9f02f818ec86d80cdd99d9aae
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-03-29 21:36:46 +08:00 committed by Xiang Xiao
parent 4306910000
commit 29cdf66e1a

View File

@ -31,6 +31,8 @@
#include <nuttx/mm/mm.h> #include <nuttx/mm/mm.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include "mm_heap/mm.h"
/**************************************************************************** /****************************************************************************
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
@ -45,8 +47,13 @@
void mm_checkcorruption(FAR struct mm_heap_s *heap) 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 *node;
FAR struct mm_allocnode_s *prev; FAR struct mm_allocnode_s *prev;
DEBUGASSERT(MM_IS_VALID(heap));
heap_impl = heap->mm_impl;
#if CONFIG_MM_REGIONS > 1 #if CONFIG_MM_REGIONS > 1
int region; int region;
#else #else
@ -56,7 +63,7 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap)
/* Visit each region */ /* Visit each region */
#if CONFIG_MM_REGIONS > 1 #if CONFIG_MM_REGIONS > 1
for (region = 0; region < heap->mm_nregions; region++) for (region = 0; region < heap_impl->mm_nregions; region++)
#endif #endif
{ {
irqstate_t flags = 0; irqstate_t flags = 0;
@ -69,7 +76,7 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap)
if (up_interrupt_context() || sched_idletask()) if (up_interrupt_context() || sched_idletask())
{ {
if (heap->mm_counts_held) if (heap_impl->mm_counts_held)
{ {
#if CONFIG_MM_REGIONS > 1 #if CONFIG_MM_REGIONS > 1
continue; continue;
@ -85,8 +92,8 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap)
mm_takesemaphore(heap); mm_takesemaphore(heap);
} }
for (node = heap->mm_heapstart[region]; for (node = heap_impl->mm_heapstart[region];
node < heap->mm_heapend[region]; node < heap_impl->mm_heapend[region];
node = (FAR struct mm_allocnode_s *) node = (FAR struct mm_allocnode_s *)
((FAR char *)node + node->size)) ((FAR char *)node + node->size))
{ {
@ -113,7 +120,7 @@ void mm_checkcorruption(FAR struct mm_heap_s *heap)
prev = node; prev = node;
} }
assert(node == heap->mm_heapend[region]); assert(node == heap_impl->mm_heapend[region]);
if (up_interrupt_context() || sched_idletask()) if (up_interrupt_context() || sched_idletask())
{ {