Skip to content
Open
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
13 changes: 13 additions & 0 deletions src/audio/mux/mux_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ static int mux_set_values(struct processing_module *mod)
struct comp_data *cd = module_get_private_data(mod);
struct comp_dev *dev = mod->dev;
struct sof_mux_config *cfg = &cd->config;
unsigned int routes = 0;
unsigned int i;
unsigned int j;

Expand Down Expand Up @@ -76,6 +77,18 @@ static int mux_set_values(struct processing_module *mod)
comp_err(dev, "mux component is not able to mix channels");
return -EINVAL;
}

/* all mux routes go to the single lookup[0] table */
for (i = 0; i < cfg->num_streams; i++) {
for (j = 0; j < PLATFORM_MAX_CHANNELS; j++)
routes += popcount(cfg->streams[i].mask[j]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The popcount() call seems unnecessary here. Earlier we already reject configurations where it returns a value greater than 1. A simple non-zero check should be sufficient and would avoid the extra popcount() operation.

}

if (routes > PLATFORM_MAX_CHANNELS) {
comp_err(dev, "%u routes exceed maximum = "
STRINGIFY(PLATFORM_MAX_CHANNELS), routes);
return -EINVAL;
}
}

for (i = 0; i < cfg->num_streams; i++) {
Expand Down
Loading