diff --git a/src/audio/mux/mux_ipc3.c b/src/audio/mux/mux_ipc3.c index a3d3beb4b708..8cfa20293b24 100644 --- a/src/audio/mux/mux_ipc3.c +++ b/src/audio/mux/mux_ipc3.c @@ -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; @@ -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]); + } + + 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++) {