Skip to content

Commit a0e6da2

Browse files
committed
Audio: EQ FIR: Remove bytes control blob set from init()
The pass of bytes control in init() was used in some very early IPC3 kernels. With IPC4 the module configuration data is not for control. If a topology does not contain a blob to initialize the control, the comp_init_data_blob() call initializes to blob handler an invalid blob that is attempted to be used in prepare(). The prepare() then fails with invalid blob detected while it should result to pass-through mode. A check is also added to prepare() for the data_size from comp_get_data_blob(). Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent da1eaa7 commit a0e6da2

1 file changed

Lines changed: 5 additions & 31 deletions

File tree

src/audio/eq_fir/eq_fir.c

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,11 @@ static int eq_fir_init(struct processing_module *mod)
247247
{
248248
struct module_data *md = &mod->priv;
249249
struct comp_dev *dev = mod->dev;
250-
struct module_config *cfg = &md->cfg;
251250
struct comp_data *cd = NULL;
252-
size_t bs = cfg->size;
253251
int i;
254-
int ret;
255252

256253
comp_info(dev, "entry");
257254

258-
/* Check first before proceeding with dev and cd that coefficients
259-
* blob size is sane.
260-
*/
261-
if (bs > SOF_EQ_FIR_MAX_SIZE) {
262-
comp_err(dev, "coefficients blob size = %zu > SOF_EQ_FIR_MAX_SIZE",
263-
bs);
264-
return -EINVAL;
265-
}
266-
267255
cd = mod_zalloc(mod, sizeof(*cd));
268256
if (!cd)
269257
return -ENOMEM;
@@ -277,31 +265,16 @@ static int eq_fir_init(struct processing_module *mod)
277265
cd->model_handler = mod_data_blob_handler_new(mod);
278266
if (!cd->model_handler) {
279267
comp_err(dev, "mod_data_blob_handler_new() failed.");
280-
ret = -ENOMEM;
281-
goto err;
268+
mod_free(mod, cd);
269+
return -ENOMEM;
282270
}
283271

284272
md->private = cd;
285273

286-
/* Allocate and make a copy of the coefficients blob and reset FIR. If
287-
* the EQ is configured later in run-time the size is zero.
288-
*/
289-
ret = comp_init_data_blob(cd->model_handler, bs, cfg->init_data);
290-
if (ret < 0) {
291-
comp_err(dev, "comp_init_data_blob() failed.");
292-
goto err_init;
293-
}
294-
295274
for (i = 0; i < PLATFORM_MAX_CHANNELS; i++)
296275
fir_reset(&cd->fir[i]);
297276

298277
return 0;
299-
300-
err_init:
301-
mod_data_blob_handler_free(mod, cd->model_handler);
302-
err:
303-
mod_free(mod, cd);
304-
return ret;
305278
}
306279

307280
static int eq_fir_free(struct processing_module *mod)
@@ -413,6 +386,7 @@ static int eq_fir_prepare(struct processing_module *mod,
413386
int channels;
414387
enum sof_ipc_frame frame_fmt;
415388
int ret = 0;
389+
size_t data_size;
416390

417391
comp_dbg(dev, "entry");
418392

@@ -435,8 +409,8 @@ static int eq_fir_prepare(struct processing_module *mod,
435409
frame_fmt = audio_stream_get_frm_fmt(&sourceb->stream);
436410

437411
cd->eq_fir_func = eq_fir_passthrough;
438-
cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL);
439-
if (cd->config) {
412+
cd->config = comp_get_data_blob(cd->model_handler, &data_size, NULL);
413+
if (cd->config && data_size > 0) {
440414
ret = eq_fir_setup(mod, channels);
441415
if (ret < 0)
442416
comp_err(dev, "eq_fir_setup failed.");

0 commit comments

Comments
 (0)