[Sound-open-firmware] [PATCH] Fix: Don't update avail trace size when DMA copying fails.

yan.wang at linux.intel.com yan.wang at linux.intel.com
Fri Mar 30 09:35:23 CEST 2018


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

When DMA copying fails, its returned copy size is negative error
number. So it shouldn't be used to update avail variable.

Signed-off-by: Yan Wang <yan.wang at linux.intel.com>
---
Test with:
Mininow max rt5651 and APL UP^2 nocodec and CNL nocodec
SOF 1.1-stable: 98d3a838cb397e91d6c032cf9b39d3748102803e
SOF-Tool 1.1-stable: 78ad1ccce5ac689680adc32f8136f5bf551b0f7c
https://github.com/plbossart/sound/tree/topic/sof-v4.14:
c33cfed51fff5eb156dcf70ba849e6ffb3008377
---
 src/lib/dma-trace.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c
index 21d1a39..d9adb6d 100644
--- a/src/lib/dma-trace.c
+++ b/src/lib/dma-trace.c
@@ -122,10 +122,11 @@ out:
 	spin_lock_irq(&d->lock, flags);
 
 	/* disregard any old messages and dont resend them if we overflow */
-	if (d->overflow) {
-		buffer->avail = DMA_TRACE_LOCAL_SIZE - size;
-	} else {
-		buffer->avail -= size;
+	if (size > 0) {
+		if (d->overflow)
+			buffer->avail = DMA_TRACE_LOCAL_SIZE - size;
+		else
+			buffer->avail -= size;
 	}
 
 	/* DMA trace copying is done, allow reschedule */
-- 
2.14.3



More information about the Sound-open-firmware mailing list