From 1c136b1d2f6a7f55bd69c6580ffc979a9880f447 Mon Sep 17 00:00:00 2001 From: Eddy Hsu Date: Thu, 21 Apr 2022 20:32:10 +0000 Subject: [PATCH] host: Clean up state on component reset Clean up host state data in hd->config in component data on reset(). Signed-off-by: Eddy Hsu --- src/audio/host.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/audio/host.c b/src/audio/host.c index 519856f53..d70f0d180 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -970,6 +970,9 @@ static int host_reset(struct comp_dev *dev) dma_sg_free(&hd->local.elem_array); dma_sg_free(&hd->config.elem_array); + /* It's safe that cleaning out `hd->config` after `dma_sg_free` for config.elem_array */ + memset(&hd->config, 0, sizeof(hd->config)); + /* free DMA buffer */ if (hd->dma_buffer) { buffer_free(hd->dma_buffer);