From d5a10013aa3dd8abbf1a8f9efc31a2379cce614b Mon Sep 17 00:00:00 2001 From: Tomasz Lauda Date: Thu, 1 Aug 2019 14:19:15 +0200 Subject: [PATCH] dw-dma: prevent from double stop sequence Adds check in dw-dma to make sure the channel is in fact in active state before doing anything. Signed-off-by: Tomasz Lauda --- src/drivers/dw/dma.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/drivers/dw/dma.c b/src/drivers/dw/dma.c index f9f0aeefc..6fd17000c 100644 --- a/src/drivers/dw/dma.c +++ b/src/drivers/dw/dma.c @@ -452,6 +452,9 @@ static int dw_dma_stop(struct dma *dma, unsigned int channel) spin_lock_irq(&dma->lock, flags); + if (chan->status != COMP_STATE_ACTIVE) + goto out; + #if CONFIG_DMA_SUSPEND_DRAIN /* channel cannot be disabled right away, so first we need to * suspend it and drain the FIFO @@ -489,6 +492,7 @@ static int dw_dma_stop(struct dma *dma, unsigned int channel) chan->status = COMP_STATE_PREPARE; +out: spin_unlock_irq(&dma->lock, flags); return 0;