dai-zephyr: fix crash in dai_reset

It is not guaranteed that 'dd->z_config' is set when dai_reset() is
called. E.g. if the requested runtime parameters are not supported by
the hardware, the parameter setup will not be completed. When
dai_reset() is called in this state, a FW crash is hit due to NULL
dereference.

Fix the issue by checking dd->z_config value before use.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This commit is contained in:
Kai Vehmanen 2023-01-11 18:28:12 +02:00 committed by Kai Vehmanen
parent e7e29b61e2
commit 7b100fc356
1 changed files with 5 additions and 3 deletions

View File

@ -982,9 +982,11 @@ static int dai_reset(struct comp_dev *dev)
dai_dma_release(dev);
dma_sg_free(&config->elem_array);
if (dd->z_config) {
rfree(dd->z_config->head_block);
rfree(dd->z_config);
dd->z_config = NULL;
}
if (dd->dma_buffer) {
buffer_free(dd->dma_buffer);