diff options
author | Sanjay R Mehta <sanju.mehta@amd.com> | 2022-02-02 16:14:40 +0100 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2022-02-15 06:24:54 +0100 |
commit | b6ccf01975976066901e0d5130669d743040d0e3 (patch) | |
tree | 15ac748358a3e54bda4da1f1c215946058c8db87 /drivers/dma | |
parent | dmaengine: ptdma: fix concurrency issue with multiple dma transfer (diff) | |
download | linux-b6ccf01975976066901e0d5130669d743040d0e3.tar.xz linux-b6ccf01975976066901e0d5130669d743040d0e3.zip |
dmaengine: ptdma: handle the cases based on DMA is complete
There is a need to segregate the cases when DMA is complete or not.
In case if DMA is already complete there is no need to handle it
again and gracefully exit from the function.
Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
Link: https://lore.kernel.org/r/1643814880-3882-3-git-send-email-Sanju.Mehta@amd.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/ptdma/ptdma-dmaengine.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/dma/ptdma/ptdma-dmaengine.c b/drivers/dma/ptdma/ptdma-dmaengine.c index e38dca422391..91b93e8d9779 100644 --- a/drivers/dma/ptdma/ptdma-dmaengine.c +++ b/drivers/dma/ptdma/ptdma-dmaengine.c @@ -100,12 +100,17 @@ static struct pt_dma_desc *pt_handle_active_desc(struct pt_dma_chan *chan, spin_lock_irqsave(&chan->vc.lock, flags); if (desc) { - if (desc->status != DMA_ERROR) - desc->status = DMA_COMPLETE; - - dma_cookie_complete(tx_desc); - dma_descriptor_unmap(tx_desc); - list_del(&desc->vd.node); + if (desc->status != DMA_COMPLETE) { + if (desc->status != DMA_ERROR) + desc->status = DMA_COMPLETE; + + dma_cookie_complete(tx_desc); + dma_descriptor_unmap(tx_desc); + list_del(&desc->vd.node); + } else { + /* Don't handle it twice */ + tx_desc = NULL; + } } desc = pt_next_dma_desc(chan); |