From d7a6b50457accdf47bdd59c0ff437ed5c866c308 Mon Sep 17 00:00:00 2001 From: Marcin Maka Date: Mon, 29 Oct 2018 15:49:12 +0100 Subject: [PATCH] dma: hda: Free size computation fixed Wrong result may impact pause/release command handlers running unaligned with work queue tick. Signed-off-by: Marcin Maka --- src/drivers/intel/cavs/hda-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/drivers/intel/cavs/hda-dma.c b/src/drivers/intel/cavs/hda-dma.c index bd168b89a..865bdc739 100644 --- a/src/drivers/intel/cavs/hda-dma.c +++ b/src/drivers/intel/cavs/hda-dma.c @@ -162,11 +162,11 @@ static inline uint32_t hda_dma_get_data_size(struct dma *dma, uint32_t chan) const uint32_t rp = host_dma_reg_read(dma, chan, DGBRP); const uint32_t wp = host_dma_reg_read(dma, chan, DGBWP); - uint32_t ds; + int32_t ds; if (!(cs & DGCS_BNE)) return 0; /* buffer is empty */ - ds = wp - rp; + ds = (int32_t)wp - (int32_t)rp; if (ds <= 0) ds += bs;