Skip to content

Commit aee54eb

Browse files
committed
Audio: DRC: Same init() cleanup
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 53cd9f3 commit aee54eb

1 file changed

Lines changed: 3 additions & 20 deletions

File tree

src/audio/drc/drc.c

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -147,24 +147,13 @@ __cold static int drc_init(struct processing_module *mod)
147147
{
148148
struct module_data *md = &mod->priv;
149149
struct comp_dev *dev = mod->dev;
150-
struct module_config *cfg = &md->cfg;
151150
struct drc_comp_data *cd;
152-
size_t bs = cfg->size;
153151
int ret;
154152

155153
assert_can_be_cold();
156154

157155
comp_info(dev, "entry");
158156

159-
/* Check first before proceeding with dev and cd that coefficients
160-
* blob size is sane.
161-
*/
162-
if (bs > SOF_DRC_MAX_SIZE) {
163-
comp_err(dev, "error: configuration blob size = %u > %d",
164-
bs, SOF_DRC_MAX_SIZE);
165-
return -EINVAL;
166-
}
167-
168157
cd = mod_zalloc(mod, sizeof(*cd));
169158
if (!cd)
170159
return -ENOMEM;
@@ -179,13 +168,6 @@ __cold static int drc_init(struct processing_module *mod)
179168
goto cd_fail;
180169
}
181170

182-
/* Get configuration data and reset DRC state */
183-
ret = comp_init_data_blob(cd->model_handler, bs, cfg->data);
184-
if (ret < 0) {
185-
comp_err(dev, "comp_init_data_blob() failed.");
186-
goto cd_fail;
187-
}
188-
189171
drc_reset_state(mod, &cd->state);
190172

191173
/* Initialize DRC to enabled. If defined by topology, a control may set
@@ -344,6 +326,7 @@ static int drc_prepare(struct processing_module *mod,
344326
struct drc_comp_data *cd = module_get_private_data(mod);
345327
struct comp_buffer *sourceb, *sinkb;
346328
struct comp_dev *dev = mod->dev;
329+
size_t data_size;
347330
int channels;
348331
int rate;
349332
int ret;
@@ -369,8 +352,8 @@ static int drc_prepare(struct processing_module *mod,
369352

370353
/* Initialize DRC */
371354
comp_info(dev, "source_format=%d", cd->source_format);
372-
cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL);
373-
if (cd->config) {
355+
cd->config = comp_get_data_blob(cd->model_handler, &data_size, NULL);
356+
if (cd->config && data_size > 0) {
374357
ret = drc_setup(mod, channels, rate);
375358
if (ret < 0) {
376359
comp_err(dev, "error: drc_setup failed.");

0 commit comments

Comments
 (0)