aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/dma/stm32-dma.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
index a884b857cba4..3056ce7f8c69 100644
--- a/drivers/dma/stm32-dma.c
+++ b/drivers/dma/stm32-dma.c
@@ -880,7 +880,7 @@ static enum dma_status stm32_dma_tx_status(struct dma_chan *c,
880 struct virt_dma_desc *vdesc; 880 struct virt_dma_desc *vdesc;
881 enum dma_status status; 881 enum dma_status status;
882 unsigned long flags; 882 unsigned long flags;
883 u32 residue; 883 u32 residue = 0;
884 884
885 status = dma_cookie_status(c, cookie, state); 885 status = dma_cookie_status(c, cookie, state);
886 if ((status == DMA_COMPLETE) || (!state)) 886 if ((status == DMA_COMPLETE) || (!state))
@@ -888,16 +888,12 @@ static enum dma_status stm32_dma_tx_status(struct dma_chan *c,
888 888
889 spin_lock_irqsave(&chan->vchan.lock, flags); 889 spin_lock_irqsave(&chan->vchan.lock, flags);
890 vdesc = vchan_find_desc(&chan->vchan, cookie); 890 vdesc = vchan_find_desc(&chan->vchan, cookie);
891 if (cookie == chan->desc->vdesc.tx.cookie) { 891 if (chan->desc && cookie == chan->desc->vdesc.tx.cookie)
892 residue = stm32_dma_desc_residue(chan, chan->desc, 892 residue = stm32_dma_desc_residue(chan, chan->desc,
893 chan->next_sg); 893 chan->next_sg);
894 } else if (vdesc) { 894 else if (vdesc)
895 residue = stm32_dma_desc_residue(chan, 895 residue = stm32_dma_desc_residue(chan,
896 to_stm32_dma_desc(vdesc), 0); 896 to_stm32_dma_desc(vdesc), 0);
897 } else {
898 residue = 0;
899 }
900
901 dma_set_residue(state, residue); 897 dma_set_residue(state, residue);
902 898
903 spin_unlock_irqrestore(&chan->vchan.lock, flags); 899 spin_unlock_irqrestore(&chan->vchan.lock, flags);