Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions src/audio/nxp/eap.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// Author: Daniel Baluta <daniel.baluta@nxp.com>

#include <rtos/panic.h>
#include <rtos/alloc.h>
#include <rtos/cache.h>
#include <rtos/init.h>
#include <rtos/string.h>
Expand Down Expand Up @@ -93,7 +92,7 @@ static int nxp_eap_init(struct processing_module *mod)
tr_info(mod->dev, "NXP EAP library, platform: %s version:%s",
info.pPlatform, info.pVersionNumber);

eap = rballoc(SOF_MEM_FLAG_USER, sizeof(*eap));
eap = mod_alloc(mod, sizeof(*eap));
if (!eap) {
comp_err(dev, "nxp_eap_init() failed to allocate module private data");
return -ENOMEM;
Expand All @@ -106,7 +105,7 @@ static int nxp_eap_init(struct processing_module *mod)
lvm_ret = LVM_GetMemoryTable(LVM_NULL, &eap->mem_tab, &eap->inst_params);
if (lvm_ret != LVM_SUCCESS) {
comp_err(dev, "nxp_eap_init() failed to get memory table %d", lvm_ret);
rfree(eap);
mod_free(mod, eap);
return -EINVAL;
}

Expand All @@ -115,8 +114,7 @@ static int nxp_eap_init(struct processing_module *mod)
eap->mem_tab.Region[i].pBaseAddress = NULL;

for (int i = 0; i < LVM_NR_MEMORY_REGIONS; i++) {
eap->mem_tab.Region[i].pBaseAddress = rballoc(SOF_MEM_FLAG_USER,
eap->mem_tab.Region[i].Size);
eap->mem_tab.Region[i].pBaseAddress = mod_balloc(mod, eap->mem_tab.Region[i].Size);
if (!eap->mem_tab.Region[i].pBaseAddress) {
comp_err(dev, "nxp_eap_init() failed to allocate memory for region %d", i);
ret = -ENOMEM;
Expand All @@ -139,11 +137,11 @@ static int nxp_eap_init(struct processing_module *mod)
free_mem:
for (int i = 0; i < LVM_NR_MEMORY_REGIONS; i++) {
if (eap->mem_tab.Region[i].pBaseAddress) {
rfree(eap->mem_tab.Region[i].pBaseAddress);
mod_free(mod, eap->mem_tab.Region[i].pBaseAddress);
eap->mem_tab.Region[i].pBaseAddress = NULL;
}
}
rfree(eap);
mod_free(mod, eap);
return ret;
}

Expand All @@ -156,12 +154,11 @@ static int nxp_eap_free(struct processing_module *mod)

for (int i = 0; i < LVM_NR_MEMORY_REGIONS; i++) {
if (eap->mem_tab.Region[i].pBaseAddress) {
rfree(eap->mem_tab.Region[i].pBaseAddress);
mod_free(mod, eap->mem_tab.Region[i].pBaseAddress);
eap->mem_tab.Region[i].pBaseAddress = NULL;
}
}

rfree(eap);
mod_free(mod, eap);

return 0;
}
Expand Down Expand Up @@ -189,13 +186,13 @@ static int nxp_eap_prepare(struct processing_module *mod,
*/
eap->buffer_bytes = NXP_EAP_DEFAULT_MAX_BLOCK_SIZE;

md->mpd.in_buff = rballoc_align(SOF_MEM_FLAG_USER, eap->buffer_bytes, 32);
md->mpd.in_buff = mod_balloc_align(mod, eap->buffer_bytes, 32);
if (!md->mpd.in_buff)
return -ENOMEM;

md->mpd.out_buff = rballoc_align(SOF_MEM_FLAG_USER, eap->buffer_bytes, 32);
md->mpd.out_buff = mod_balloc_align(mod, eap->buffer_bytes, 32);
if (!md->mpd.out_buff) {
rfree(md->mpd.in_buff);
mod_free(mod, md->mpd.in_buff);
return -ENOMEM;
}

Expand All @@ -213,13 +210,13 @@ static int nxp_eap_reset(struct processing_module *mod)
comp_dbg(dev, "nxp_eap_reset");

if (md->mpd.in_buff) {
rfree(md->mpd.in_buff);
mod_free(mod, md->mpd.in_buff);
md->mpd.in_buff = NULL;
md->mpd.in_buff_size = 0;
}

if (md->mpd.out_buff) {
rfree(md->mpd.out_buff);
mod_free(mod, md->mpd.out_buff);
md->mpd.out_buff = NULL;
md->mpd.out_buff_size = 0;
}
Expand Down
14 changes: 7 additions & 7 deletions src/audio/rtnr/rtnr.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ static int rtnr_init(struct processing_module *mod)
return -EINVAL;
}

cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd));
cd = mod_zalloc(mod, sizeof(*cd));
if (!cd)
return -ENOMEM;

Expand All @@ -250,9 +250,9 @@ static int rtnr_init(struct processing_module *mod)
cd->process_enable = true;

/* Handler for component data */
cd->model_handler = comp_data_blob_handler_new(dev);
cd->model_handler = mod_data_blob_handler_new(mod);
if (!cd->model_handler) {
comp_err(dev, "comp_data_blob_handler_new() failed.");
comp_err(dev, "mod_data_blob_handler_new() failed.");
ret = -ENOMEM;
goto cd_fail;
}
Expand Down Expand Up @@ -285,8 +285,8 @@ static int rtnr_init(struct processing_module *mod)
return 0;

cd_fail:
comp_data_blob_handler_free(cd->model_handler);
rfree(cd);
mod_data_blob_handler_free(mod, cd->model_handler);
mod_free(mod, cd);
return ret;
}

Expand All @@ -296,11 +296,11 @@ static int rtnr_free(struct processing_module *mod)

comp_info(mod->dev, "rtnr_free()");

comp_data_blob_handler_free(cd->model_handler);
mod_data_blob_handler_free(mod, cd->model_handler);

RTKMA_API_Context_Free(cd->rtk_agl);

rfree(cd);
mod_free(mod, cd);
return 0;
}

Expand Down
4 changes: 2 additions & 2 deletions src/audio/selector/selector.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ static int selector_init(struct processing_module *mod)
return -EINVAL;
}

cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd));
cd = mod_zalloc(mod, sizeof(*cd));
if (!cd)
return -ENOMEM;

Expand Down Expand Up @@ -733,7 +733,7 @@ static int selector_free(struct processing_module *mod)

comp_dbg(mod->dev, "selector_free()");

rfree(cd);
mod_free(mod, cd);

return 0;
}
Expand Down
Loading