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
25 changes: 1 addition & 24 deletions src/audio/module_adapter/module/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@

LOG_MODULE_DECLARE(module_adapter, CONFIG_SOF_LOG_LEVEL);

/*****************************************************************************/
/* Local helper functions */
/*****************************************************************************/
static int validate_config(struct module_config *cfg);

int module_load_config(struct comp_dev *dev, const void *cfg, size_t size)
{
int ret;
Expand Down Expand Up @@ -52,30 +47,18 @@ int module_load_config(struct comp_dev *dev, const void *cfg, size_t size)
}
if (!dst->data) {
comp_err(dev, "module_load_config(): failed to allocate space for setup config.");
ret = -ENOMEM;
goto err;
return -ENOMEM;
}

ret = memcpy_s(dst->data, size, cfg, size);
assert(!ret);
ret = validate_config(dst->data);
if (ret) {
comp_err(dev, "module_load_config(): validation of config failed!");
ret = -EINVAL;
goto err;
}

/* Config loaded, mark it as valid */
dst->size = size;
dst->avail = true;

comp_dbg(dev, "module_load_config() done");
return ret;
err:
if (dst->data)
rfree(dst->data);
dst->data = NULL;
return ret;
}

int module_init(struct processing_module *mod)
Expand Down Expand Up @@ -190,12 +173,6 @@ int module_free_memory(struct processing_module *mod, void *ptr)
return -EINVAL;
}

static int validate_config(struct module_config *cfg)
{
/* TODO: validation of codec specific setup config */
return 0;
}

int module_prepare(struct processing_module *mod,
struct sof_source **sources, int num_of_sources,
struct sof_sink **sinks, int num_of_sinks)
Expand Down
2 changes: 1 addition & 1 deletion src/audio/module_adapter/module_adapter_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ int module_adapter_init_data(struct comp_dev *dev,
if (size) {
ret = module_load_config(dev, data, size);
if (ret < 0) {
comp_err(dev, "module_adapter_new() error %d: config loading has failed.",
comp_err(dev, "module_adapter_init_data() error %d: config loading has failed.",
ret);
return ret;
}
Expand Down