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 <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2019-08-01 14:19:15 +02:00 committed by Tomasz Lauda
parent 3ed68f15af
commit d5a10013aa
1 changed files with 4 additions and 0 deletions

View File

@ -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;