dmaengine: stm32-dma: mark pending descriptor complete in terminate_all
authorAmelie Delaunay <amelie.delaunay@foss.st.com>
Mon, 11 Oct 2021 09:42:57 +0000 (11:42 +0200)
committerVinod Koul <vkoul@kernel.org>
Mon, 18 Oct 2021 06:42:50 +0000 (12:12 +0530)
To prevent accidental repeated completion, mark pending descriptor
complete in terminate_all. It can be the case when terminate_all is called
while no end of transfer interrupt occurs.

Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20211011094259.315023-2-amelie.delaunay@foss.st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/stm32-dma.c

index 9063c72..a5ccf3f 100644 (file)
@@ -497,6 +497,7 @@ static int stm32_dma_terminate_all(struct dma_chan *c)
        spin_lock_irqsave(&chan->vchan.lock, flags);
 
        if (chan->desc) {
+               dma_cookie_complete(&chan->desc->vdesc.tx);
                vchan_terminate_vdesc(&chan->desc->vdesc);
                if (chan->busy)
                        stm32_dma_stop(chan);