Commit 935d31fd authored by Jyri Sarha's avatar Jyri Sarha Committed by Mark Brown

ASoC: SOF: ipc4/intel: Add missing mutex_unlock()

There was a missing mutex_unlock() in sof_ipc4_widget_free()
use_chain_dma if-branch that caused a static analysis error. The
branch should not be used in a normal working configuration and if its
used its an indication of a bad topology. Add missing mutex_unlock()
and a warning print if the if-branch is taken, and another warning
print to a symmetric place in sof_ipc4_widget_setup().

Fixes: ca5ce0ca ("ASoC: SOF: ipc4/intel: Add support for chained DMA")
Reported-by: default avatarkernel test robot <lkp@intel.com>
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/202303222050.dCw0fPCW-lkp@intel.com/Signed-off-by: default avatarJyri Sarha <jyri.sarha@linux.intel.com>
Link: https://lore.kernel.org/r/20230322181830.574635-1-jyri.sarha@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ba31f89c
......@@ -1989,8 +1989,11 @@ static int sof_ipc4_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget
case snd_soc_dapm_scheduler:
pipeline = swidget->private;
if (pipeline->use_chain_dma)
if (pipeline->use_chain_dma) {
dev_warn(sdev->dev, "use_chain_dma set for schduler %s",
swidget->widget->name);
return 0;
}
dev_dbg(sdev->dev, "pipeline: %d memory pages: %d\n", swidget->pipeline_id,
pipeline->mem_usage);
......@@ -2145,8 +2148,12 @@ static int sof_ipc4_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget
struct sof_ipc4_msg msg = {{ 0 }};
u32 header;
if (pipeline->use_chain_dma)
if (pipeline->use_chain_dma) {
dev_warn(sdev->dev, "use_chain_dma set for schduler %s",
swidget->widget->name);
mutex_unlock(&ipc4_data->pipeline_state_mutex);
return 0;
}
header = SOF_IPC4_GLB_PIPE_INSTANCE_ID(swidget->instance_id);
header |= SOF_IPC4_MSG_TYPE_SET(SOF_IPC4_GLB_DELETE_PIPELINE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment