Skip to content

Commit 05e2ce1

Browse files
committed
Audio: EQ IIR: 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 a0e6da2 commit 05e2ce1

1 file changed

Lines changed: 7 additions & 27 deletions

File tree

src/audio/eq_iir/eq_iir.c

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,11 @@ static int eq_iir_init(struct processing_module *mod)
4444
{
4545
struct module_data *md = &mod->priv;
4646
struct comp_dev *dev = mod->dev;
47-
struct module_config *cfg = &md->cfg;
4847
struct comp_data *cd;
49-
size_t bs = cfg->size;
50-
int i, ret;
48+
int i;
5149

5250
comp_info(dev, "entry");
5351

54-
/* Check first before proceeding with dev and cd that coefficients blob size is sane */
55-
if (bs > SOF_EQ_IIR_MAX_SIZE) {
56-
comp_err(dev, "coefficients blob size %zu exceeds maximum", bs);
57-
return -EINVAL;
58-
}
59-
6052
cd = mod_zalloc(mod, sizeof(*cd));
6153
if (!cd)
6254
return -ENOMEM;
@@ -67,28 +59,15 @@ static int eq_iir_init(struct processing_module *mod)
6759
cd->model_handler = mod_data_blob_handler_new(mod);
6860
if (!cd->model_handler) {
6961
comp_err(dev, "mod_data_blob_handler_new() failed.");
70-
ret = -ENOMEM;
71-
goto err;
72-
}
73-
74-
/* Allocate and make a copy of the coefficients blob and reset IIR. If
75-
* the EQ is configured later in run-time the size is zero.
76-
*/
77-
ret = comp_init_data_blob(cd->model_handler, bs, cfg->data);
78-
if (ret < 0) {
79-
comp_err(dev, "comp_init_data_blob() failed with error: %d", ret);
80-
goto err;
62+
mod_data_blob_handler_free(mod, cd->model_handler);
63+
mod_free(mod, cd);
64+
return -ENOMEM;
8165
}
8266

8367
for (i = 0; i < PLATFORM_MAX_CHANNELS; i++)
8468
iir_reset_df1(&cd->iir[i]);
8569

8670
return 0;
87-
88-
err:
89-
mod_data_blob_handler_free(mod, cd->model_handler);
90-
mod_free(mod, cd);
91-
return ret;
9271
}
9372

9473
static int eq_iir_free(struct processing_module *mod)
@@ -180,6 +159,7 @@ static int eq_iir_prepare(struct processing_module *mod,
180159
struct comp_dev *dev = mod->dev;
181160
enum sof_ipc_frame source_format;
182161
enum sof_ipc_frame sink_format;
162+
size_t data_size;
183163
int channels;
184164
int ret = 0;
185165

@@ -204,7 +184,7 @@ static int eq_iir_prepare(struct processing_module *mod,
204184
source_format = audio_stream_get_frm_fmt(&sourceb->stream);
205185
sink_format = audio_stream_get_frm_fmt(&sinkb->stream);
206186

207-
cd->config = comp_get_data_blob(cd->model_handler, NULL, NULL);
187+
cd->config = comp_get_data_blob(cd->model_handler, &data_size, NULL);
208188

209189
/* Initialize EQ */
210190
comp_info(dev, "source_format=%d, sink_format=%d",
@@ -213,7 +193,7 @@ static int eq_iir_prepare(struct processing_module *mod,
213193
eq_iir_set_passthrough_func(cd, source_format, sink_format);
214194

215195
/* Initialize EQ */
216-
if (cd->config) {
196+
if (cd->config && data_size > 0) {
217197
ret = eq_iir_new_blob(mod, source_format, sink_format, channels);
218198
if (ret)
219199
return ret;

0 commit comments

Comments
 (0)