ipc: ipc3: handler: Fix error handling in ipc_dma_trace_config()

We need to free up the allocated SG in case of a failure after a successful
ipc_process_host_buffer() call, which does the allocation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
This commit is contained in:
Peter Ujfalusi 2022-02-17 14:25:02 +02:00 committed by Liam Girdwood
parent 1745148343
commit fbab621c9b
1 changed files with 7 additions and 1 deletions

View File

@ -824,7 +824,7 @@ static int ipc_dma_trace_config(uint32_t header)
&elem_array,
&ring_size);
if (err < 0)
goto error;
goto processing_error;
err = dma_trace_host_buffer(dmat, &elem_array, ring_size);
if (err < 0) {
@ -849,6 +849,12 @@ static int ipc_dma_trace_config(uint32_t header)
return 0;
error:
#if CONFIG_HOST_PTABLE
dma_sg_free(&elem_array);
processing_error:
#endif
return err;
}
#endif /* CONFIG_SUECREEK */