alloc.c: fix DEBUG_TRACE_PTR() not to trace before trace is initialized

As reported in #4759, #4636 and a few others linked from there.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
This commit is contained in:
Marc Herbert 2021-09-14 04:57:10 +00:00 committed by Liam Girdwood
parent 4f273961ab
commit 3ff1dc0277
1 changed files with 3 additions and 3 deletions

View File

@ -646,13 +646,13 @@ out:
} }
#define DEBUG_TRACE_PTR(ptr, bytes, zone, caps, flags) \ #define DEBUG_TRACE_PTR(ptr, bytes, zone, caps, flags) \
do { \ if (trace_get()) { \
if (!ptr) { \ if (!ptr) { \
tr_err(&mem_tr, "failed to alloc 0x%x bytes zone 0x%x caps 0x%x flags 0x%x", \ tr_err(&mem_tr, "failed to alloc 0x%x bytes zone 0x%x caps 0x%x flags 0x%x", \
bytes, zone, caps, flags); \ bytes, zone, caps, flags); \
alloc_trace_heap(zone, caps, bytes); \ alloc_trace_heap(zone, caps, bytes); \
} \ }
} while (0)
#else #else
#define DEBUG_TRACE_PTR(ptr, bytes, zone, caps, flags) #define DEBUG_TRACE_PTR(ptr, bytes, zone, caps, flags)
#endif #endif