[Sound-open-firmware] [PATCH v3 13/27] host: reset pointers at new() and reset()

Keyon Jie yang.jie at linux.intel.com
Sat Feb 11 03:17:53 CET 2017


We need to clear those pointers at new(), and undo at reset()
those initialization what we did in set_params().

For new(), rzalloc() will help set host_data members to 0s and
NULLs.

Signed-off-by: Keyon Jie <yang.jie at linux.intel.com>
---
 src/audio/host.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/audio/host.c b/src/audio/host.c
index 6a4c669..c8479c7 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -420,12 +420,6 @@ static struct comp_dev *host_new(uint32_t type, uint32_t index,
 	hd->dma = dma_get(DMA_ID_DMAC0);
 	if (hd->dma == NULL)
 		goto error;
-	hd->host_size = 0;
-	hd->host_period_bytes = 0;
-	hd->host_pos = NULL;
-	hd->source = NULL;
-	hd->sink = NULL;
-	hd->split_remaining = 0;
 	work_init(&hd->work, host_finish_work, dev, WORK_ASYNC);
 
 	/* init buffer elems */
@@ -740,10 +734,14 @@ static int host_reset(struct comp_dev *dev)
 	}
 
 	hd->host_size = 0;
+	hd->host_avail= 0;
 	if (hd->host_pos)
 		*hd->host_pos = 0;
 	hd->host_pos = NULL;
+	hd->host_app_pos = 0;
+
 	hd->host_period_bytes = 0;
+	hd->host_pos_read = 0;
 	hd->source = NULL;
 	hd->sink = NULL;
 	dev->state = COMP_STATE_INIT;
-- 
2.7.4



More information about the Sound-open-firmware mailing list