Skip to content

Commit c984f39

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 0eb179b commit c984f39

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
@@ -624,12 +624,13 @@ EXPORT_SYMBOL(comp_data_blob_get_cmd);
624624

625625
static void *default_alloc(size_t size)
626626
{
627-
return rballoc(SOF_MEM_FLAG_USER, size);
627+
return sof_heap_alloc(sof_sys_user_heap_get(),
628+
SOF_MEM_FLAG_USER | SOF_MEM_FLAG_LARGE_BUFFER, size, 0);
628629
}
629630

630631
static void default_free(void *buf)
631632
{
632-
rfree(buf);
633+
sof_heap_free(sof_sys_user_heap_get(), buf);
633634
}
634635

635636
struct comp_data_blob_handler *
@@ -641,10 +642,11 @@ comp_data_blob_handler_new_ext(struct comp_dev *dev, bool single_blob,
641642

642643
comp_dbg(dev, "entry");
643644

644-
handler = rzalloc(SOF_MEM_FLAG_USER,
645-
sizeof(struct comp_data_blob_handler));
645+
handler = sof_heap_alloc(sof_sys_user_heap_get(), SOF_MEM_FLAG_USER,
646+
sizeof(struct comp_data_blob_handler), 0);
646647

647648
if (handler) {
649+
memset(handler, 0, sizeof(*handler));
648650
handler->dev = dev;
649651
handler->single_blob = single_blob;
650652
handler->alloc = alloc ? alloc : default_alloc;
@@ -662,6 +664,6 @@ void comp_data_blob_handler_free(struct comp_data_blob_handler *blob_handler)
662664

663665
comp_free_data_blob(blob_handler);
664666

665-
rfree(blob_handler);
667+
sof_heap_free(sof_sys_user_heap_get(), blob_handler);
666668
}
667669
EXPORT_SYMBOL(comp_data_blob_handler_free);

0 commit comments

Comments
 (0)