summaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorThomas Gleixner2014-04-28 21:19:51 +0200
committerVinod Koul2014-04-30 07:02:15 +0200
commitde135939716dcdc8a6ea62e9228feb2eec0fca11 (patch)
treeaf4c1aec22c4e52377ea47cdb88ba4da62d3577e /drivers/dma
parentdmaengine: edma: Sanitize residue reporting (diff)
downloadkernel-qcow2-linux-de135939716dcdc8a6ea62e9228feb2eec0fca11.tar.gz
kernel-qcow2-linux-de135939716dcdc8a6ea62e9228feb2eec0fca11.tar.xz
kernel-qcow2-linux-de135939716dcdc8a6ea62e9228feb2eec0fca11.zip
dmaengine: edma: Check the current decriptor first in tx_status()
It's likely that the caller investigates the status of a currently active descriptor. Make that simple check first and only rumage in the vchan list if that fails. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Joel Fernandes <joelf@ti.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/edma.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
index 30cbbde52364..cfc267e819eb 100644
--- a/drivers/dma/edma.c
+++ b/drivers/dma/edma.c
@@ -852,11 +852,10 @@ static enum dma_status edma_tx_status(struct dma_chan *chan,
return ret;
spin_lock_irqsave(&echan->vchan.lock, flags);
- vdesc = vchan_find_desc(&echan->vchan, cookie);
- if (vdesc)
- txstate->residue = to_edma_desc(&vdesc->tx)->residue;
- else if (echan->edesc && echan->edesc->vdesc.tx.cookie == cookie)
+ if (echan->edesc && echan->edesc->vdesc.tx.cookie == cookie)
txstate->residue = echan->edesc->residue;
+ else if ((vdesc = vchan_find_desc(&echan->vchan, cookie)))
+ txstate->residue = to_edma_desc(&vdesc->tx)->residue;
spin_unlock_irqrestore(&echan->vchan.lock, flags);
return ret;