Skip to content

Commit 4d9e655

Browse files
committed
module-adapter: move stream parameters to the module heap
Stream parameters are only used by respective modules, move them to the module's own heap. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 4677f19 commit 4d9e655

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/audio/module_adapter/module_adapter.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ int module_adapter_params(struct comp_dev *dev, struct sof_ipc_stream_params *pa
562562
{
563563
int ret;
564564
struct processing_module *mod = comp_mod(dev);
565+
struct k_heap *mod_heap = mod->priv.resources.heap;
565566

566567
module_adapter_set_params(mod, params);
567568

@@ -572,11 +573,11 @@ int module_adapter_params(struct comp_dev *dev, struct sof_ipc_stream_params *pa
572573
}
573574

574575
/* allocate stream_params each time */
575-
if (mod->stream_params)
576-
rfree(mod->stream_params);
576+
sof_heap_free(mod_heap, mod->stream_params);
577577

578-
mod->stream_params = rzalloc(SOF_MEM_FLAG_USER,
579-
sizeof(*mod->stream_params) + params->ext_data_length);
578+
mod->stream_params = sof_heap_alloc(mod_heap, 0,
579+
sizeof(*mod->stream_params) + params->ext_data_length,
580+
0);
580581
if (!mod->stream_params)
581582
return -ENOMEM;
582583

@@ -1252,6 +1253,7 @@ int module_adapter_reset(struct comp_dev *dev)
12521253
{
12531254
int ret, i;
12541255
struct processing_module *mod = comp_mod(dev);
1256+
struct k_heap *mod_heap = mod->priv.resources.heap;
12551257
struct list_item *blist;
12561258

12571259
comp_dbg(dev, "resetting");
@@ -1287,7 +1289,7 @@ int module_adapter_reset(struct comp_dev *dev)
12871289
buffer_zero(buffer);
12881290
}
12891291

1290-
rfree(mod->stream_params);
1292+
sof_heap_free(mod_heap, mod->stream_params);
12911293
mod->stream_params = NULL;
12921294

12931295
comp_dbg(dev, "done");

0 commit comments

Comments
 (0)