Skip to content

Commit 1f98fbe

Browse files
committed
Audio: Crossover: same for init()
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent c7ddaf4 commit 1f98fbe

1 file changed

Lines changed: 4 additions & 18 deletions

File tree

src/audio/crossover/crossover.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -296,19 +296,10 @@ static int crossover_init(struct processing_module *mod)
296296
struct module_data *md = &mod->priv;
297297
struct comp_dev *dev = mod->dev;
298298
struct comp_data *cd;
299-
const struct module_config *ipc_crossover = &md->cfg;
300-
size_t bs = ipc_crossover->size;
301299
int ret;
302300

303301
comp_info(dev, "entry");
304302

305-
/* Check that the coefficients blob size is sane */
306-
if (bs > SOF_CROSSOVER_MAX_SIZE) {
307-
comp_err(dev, "blob size (%d) exceeds maximum allowed size (%i)",
308-
bs, SOF_CROSSOVER_MAX_SIZE);
309-
return -ENOMEM;
310-
}
311-
312303
cd = mod_zalloc(mod, sizeof(*cd));
313304
if (!cd)
314305
return -ENOMEM;
@@ -323,13 +314,6 @@ static int crossover_init(struct processing_module *mod)
323314
goto cd_fail;
324315
}
325316

326-
/* Get configuration data and reset Crossover state */
327-
ret = comp_init_data_blob(cd->model_handler, bs, ipc_crossover->data);
328-
if (ret < 0) {
329-
comp_err(dev, "comp_init_data_blob() failed.");
330-
goto cd_fail;
331-
}
332-
333317
ret = crossover_output_pin_init(mod);
334318
if (ret < 0) {
335319
comp_err(dev, "failed.");
@@ -527,6 +511,7 @@ static int crossover_prepare(struct processing_module *mod,
527511
struct comp_data *cd = module_get_private_data(mod);
528512
struct comp_dev *dev = mod->dev;
529513
struct comp_buffer *source, *sink;
514+
size_t data_size;
530515
int channels;
531516

532517
comp_info(dev, "entry");
@@ -558,10 +543,11 @@ static int crossover_prepare(struct processing_module *mod,
558543
comp_info(dev, "source_format=%d, sink_formats=%d, nch=%d",
559544
cd->source_format, cd->source_format, channels);
560545

561-
cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL);
546+
cd->config = comp_get_data_blob(cd->model_handler, &data_size, NULL);
562547

563548
/* Initialize Crossover */
564-
if (cd->config && crossover_validate_config(mod, cd->config) < 0) {
549+
if (cd->config && data_size > 0 &&
550+
crossover_validate_config(mod, cd->config) < 0) {
565551
/* If config is invalid then delete it */
566552
comp_err(dev, "invalid binary config format");
567553
crossover_free_config(&cd->config);

0 commit comments

Comments
 (0)