ipc4: handler: chain_dma: Handle chain free when the chain_dma is not created

Do not treat as error if the chain dma is asked to be destroyed if it has
not been created yet.

The kernel might send such a request under special circumstances:
the PCM is opened, configured but never started/triggered then just closed,
freed.

This is the same way how pipelines are handled, but in case of pipelines
we use the pipe state.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
This commit is contained in:
Peter Ujfalusi 2023-05-30 10:33:54 +03:00 committed by Kai Vehmanen
parent 493e2dd3e9
commit 40625f0de3
1 changed files with 8 additions and 1 deletions

View File

@ -484,7 +484,14 @@ static int ipc4_process_chain_dma(struct ipc4_message_request *ipc4)
comp_id = IPC4_COMP_ID(cdma.primary.r.host_dma_id + IPC4_MAX_MODULE_COUNT, 0);
cdma_comp = ipc_get_comp_by_id(ipc, comp_id);
if (!cdma_comp && cdma.primary.r.allocate && cdma.primary.r.enable) {
if (!cdma_comp) {
/*
* Nothing to do when the chainDMA is not allocated and asked to
* be freed
*/
if (!cdma.primary.r.allocate && !cdma.primary.r.enable)
return IPC4_SUCCESS;
ret = ipc4_chain_manager_create(&cdma);
if (ret < 0)
return IPC4_FAILURE;