Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
softwarecki committed Sep 13, 2024
1 parent 72faaf3 commit 14651a6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zephyr/lib/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,12 @@ void *rmalloc(enum mem_zone zone, uint32_t flags, uint32_t caps, size_t bytes)
{
void *ptr;
struct k_heap *heap;

const char *hn = "none";
/* choose a heap */
if (caps & SOF_MEM_CAPS_L3) {
#if CONFIG_L3_HEAP
heap = &l3_heap;
hn = "l3_heap";
/* Uncached L3_HEAP should be not used */
if (!zone_is_cached(zone)) {
tr_err(&zephyr_tr, "L3_HEAP available for cached zones only!");
Expand All @@ -402,6 +403,7 @@ void *rmalloc(enum mem_zone zone, uint32_t flags, uint32_t caps, size_t bytes)
#endif
} else {
heap = &sof_heap;
hn = "sof_heap";
}

if (zone_is_cached(zone) && !(flags & SOF_MEM_FLAG_COHERENT)) {
Expand All @@ -413,6 +415,8 @@ void *rmalloc(enum mem_zone zone, uint32_t flags, uint32_t caps, size_t bytes)
*/
ptr = heap_alloc_aligned(heap, PLATFORM_DCACHE_ALIGN, bytes);
}
if (!ptr)
tr_err(&zephyr_tr, "Failed to allocate %zu from %s!", bytes, hn);

if (!ptr && zone == SOF_MEM_ZONE_SYS)
k_panic();
Expand Down

0 comments on commit 14651a6

Please sign in to comment.