Skip to content

Commit e200f37

Browse files
committed
debug
1 parent 0628acf commit e200f37

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

zephyr/lib/alloc.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,17 @@ void *rballoc_align(uint32_t flags, uint32_t caps, size_t bytes,
482482
uint32_t align)
483483
{
484484
struct k_heap *heap;
485+
void *ret;
485486

486487
/* choose a heap */
487488
if (caps & SOF_MEM_CAPS_L3) {
488489
#if CONFIG_L3_HEAP
489490
heap = &l3_heap;
490-
return (__sparse_force void *)l3_heap_alloc_aligned(heap, align, bytes);
491+
ret = l3_heap_alloc_aligned(heap, align, bytes);
492+
if (!ret)
493+
tr_err(&zephyr_tr, "!l3_heap_alloc_aligned");
494+
495+
return (__sparse_force void *)ret;
491496
#else
492497
tr_err(&zephyr_tr, "L3_HEAP not available.");
493498
return NULL;
@@ -498,14 +503,25 @@ void *rballoc_align(uint32_t flags, uint32_t caps, size_t bytes,
498503

499504
#if CONFIG_VIRTUAL_HEAP
500505
/* Use virtual heap if it is available */
501-
if (virtual_buffers_heap)
502-
return virtual_heap_alloc(virtual_buffers_heap, flags, caps, bytes, align);
506+
if (virtual_buffers_heap) {
507+
ret = virtual_heap_alloc(virtual_buffers_heap, flags, caps, bytes, align);
508+
if (!ret)
509+
tr_err(&zephyr_tr, "!virtual_heap_alloc");
510+
return ret;
511+
}
503512
#endif /* CONFIG_VIRTUAL_HEAP */
504513

505-
if (flags & SOF_MEM_FLAG_COHERENT)
506-
return heap_alloc_aligned(heap, align, bytes);
514+
if (flags & SOF_MEM_FLAG_COHERENT) {
515+
ret = heap_alloc_aligned(heap, align, bytes);
516+
if (!ret)
517+
tr_err(&zephyr_tr, "!heap_alloc_aligned");
518+
return ret;
519+
}
507520

508-
return (__sparse_force void *)heap_alloc_aligned_cached(heap, align, bytes);
521+
ret = heap_alloc_aligned_cached(heap, align, bytes);
522+
if (!ret)
523+
tr_err(&zephyr_tr, "!heap_alloc_aligned_cached");
524+
return (__sparse_force void *)ret;
509525
}
510526
EXPORT_SYMBOL(rballoc_align);
511527

0 commit comments

Comments
 (0)