Skip to content

Commit 96833ac

Browse files
committed
audio: module_adapter: make data_blob compatible with user-space
Use user-space friendy sof_heap_alloc() for dynamic allocations in data_blob handler. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 6d09634 commit 96833ac

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/audio/data_blob.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -661,12 +661,13 @@ EXPORT_SYMBOL(comp_data_blob_get_cmd);
661661

662662
static void *default_alloc(size_t size)
663663
{
664-
return rballoc(SOF_MEM_FLAG_USER, size);
664+
return sof_heap_alloc(sof_sys_user_heap_get(),
665+
SOF_MEM_FLAG_USER | SOF_MEM_FLAG_LARGE_BUFFER, size, 0);
665666
}
666667

667668
static void default_free(void *buf)
668669
{
669-
rfree(buf);
670+
sof_heap_free(sof_sys_user_heap_get(), buf);
670671
}
671672

672673
struct comp_data_blob_handler *
@@ -678,10 +679,11 @@ comp_data_blob_handler_new_ext(struct comp_dev *dev, bool single_blob,
678679

679680
comp_dbg(dev, "entry");
680681

681-
handler = rzalloc(SOF_MEM_FLAG_USER,
682-
sizeof(struct comp_data_blob_handler));
682+
handler = sof_heap_alloc(sof_sys_user_heap_get(), SOF_MEM_FLAG_USER,
683+
sizeof(struct comp_data_blob_handler), 0);
683684

684685
if (handler) {
686+
memset(handler, 0, sizeof(*handler));
685687
handler->dev = dev;
686688
handler->single_blob = single_blob;
687689
handler->alloc = alloc ? alloc : default_alloc;
@@ -699,6 +701,6 @@ void comp_data_blob_handler_free(struct comp_data_blob_handler *blob_handler)
699701

700702
comp_free_data_blob(blob_handler);
701703

702-
rfree(blob_handler);
704+
sof_heap_free(sof_sys_user_heap_get(), blob_handler);
703705
}
704706
EXPORT_SYMBOL(comp_data_blob_handler_free);

0 commit comments

Comments
 (0)