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
24 changes: 14 additions & 10 deletions src/audio/eq_fir.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,20 @@ static struct comp_dev *eq_fir_new(struct sof_ipc_comp *comp)
struct comp_data *cd;
struct sof_ipc_comp_eq_fir *ipc_fir
= (struct sof_ipc_comp_eq_fir *)comp;
size_t bs;
size_t bs = ipc_fir->size;
int i;

trace_eq("new");

/* Check first before proceeding with dev and cd that coefficients
* blob size is sane.
*/
if (bs > SOF_EQ_FIR_MAX_SIZE) {
trace_eq_error("ens");
trace_error_value(bs);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, trace has been updated so you can pass > 1 value with one call. These can be done as incremental changes in EQ etc

return NULL;
}

dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_eq_fir));
if (!dev)
Expand All @@ -267,19 +276,14 @@ static struct comp_dev *eq_fir_new(struct sof_ipc_comp *comp)

comp_set_drvdata(dev, cd);

bs = ipc_fir->size;
if (bs > SOF_EQ_FIR_MAX_SIZE) {
rfree(dev);
rfree(cd);
return NULL;
}

cd->eq_fir_func = eq_fir_passthrough;
cd->eq_fir_func_odd = eq_fir_passthrough;
cd->config = NULL;

/* Allocate and make a copy of the blob and setup FIR */
if (bs > 0) {
/* Allocate and make a copy of the coefficients blob and reset FIR. If
* the EQ is configured later in run-time the size is zero.
*/
if (bs) {
cd->config = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, bs);
if (!cd->config) {
rfree(dev);
Expand Down
24 changes: 14 additions & 10 deletions src/audio/eq_iir.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,20 @@ static struct comp_dev *eq_iir_new(struct sof_ipc_comp *comp)
struct comp_data *cd;
struct sof_ipc_comp_eq_iir *ipc_iir =
(struct sof_ipc_comp_eq_iir *)comp;
size_t bs;
size_t bs = ipc_iir->size;
int i;

trace_eq("new");

/* Check first before proceeding with dev and cd that coefficients
* blob size is sane.
*/
if (bs > SOF_EQ_IIR_MAX_SIZE) {
trace_eq_error("ens");
trace_error_value(bs);
return NULL;
}

dev = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM,
COMP_SIZE(struct sof_ipc_comp_eq_iir));
if (!dev)
Expand All @@ -365,15 +374,10 @@ static struct comp_dev *eq_iir_new(struct sof_ipc_comp *comp)
cd->iir_delay_size = 0;
cd->config = NULL;

bs = ipc_iir->size;
if (bs > SOF_EQ_IIR_MAX_SIZE) {
rfree(dev);
rfree(cd);
return NULL;
}

/* Allocate and make a copy of the blob and setup IIR */
if (bs > 0) {
/* Allocate and make a copy of the coefficients blob and reset IIR. If
* the EQ is configured later in run-time the size is zero.
*/
if (bs) {
cd->config = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, bs);
if (!cd->config) {
rfree(dev);
Expand Down