[Sound-open-firmware] [PATCH 4/4] Fix DMA host offset calculation.

yan.wang at linux.intel.com yan.wang at linux.intel.com
Thu Nov 9 07:17:53 CET 2017


From: Yan Wang <yan.wang at linux.intel.com>

1. "size" should not be considered twice.
2. Change host_offset to uint32_t type.

Signed-off-by: Yan Wang <yan.wang at linux.intel.com>
---
 src/include/reef/dma-trace.h | 2 +-
 src/lib/dma-trace.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/include/reef/dma-trace.h b/src/include/reef/dma-trace.h
index 12d0956..641a4dc 100644
--- a/src/include/reef/dma-trace.h
+++ b/src/include/reef/dma-trace.h
@@ -56,7 +56,7 @@ struct dma_trace_data {
 	struct dma_sg_config config;
 	struct dma_trace_buf dmatb;
 	struct dma_copy dc;
-	int32_t host_offset;
+	uint32_t host_offset;
 	uint32_t host_size;
 	struct work dmat_work;
 	uint32_t enabled;
diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c
index 5885037..249e18b 100644
--- a/src/lib/dma-trace.c
+++ b/src/lib/dma-trace.c
@@ -90,7 +90,7 @@ static uint64_t trace_work(void *data, uint64_t delay)
 
 	/* update host pointer and check for wrap */
 	d->host_offset += size;
-	if (d->host_offset + size >= d->host_size)
+	if (d->host_offset >= d->host_size)
 		d->host_offset = 0;
 
 	/* update local pointer and check for wrap */
-- 
2.7.4



More information about the Sound-open-firmware mailing list