dmaengine: sun6i-dma: Only calculate residue if state exists.
authorPeter Griffin <peter.griffin@linaro.org>
Tue, 7 Jun 2016 17:38:39 +0000 (18:38 +0100)
committerVinod Koul <vinod.koul@intel.com>
Tue, 21 Jun 2016 16:05:00 +0000 (21:35 +0530)
There is no point in calculating the residue if state does not
exist to store the value.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/sun6i-dma.c

index 5065ca43facede040f92a2ac64fa35c147675fe3..3835fcde35456fb20e89e77d5b02644b98df4df8 100644 (file)
@@ -865,7 +865,7 @@ static enum dma_status sun6i_dma_tx_status(struct dma_chan *chan,
        size_t bytes = 0;
 
        ret = dma_cookie_status(chan, cookie, state);
-       if (ret == DMA_COMPLETE)
+       if (ret == DMA_COMPLETE || !state)
                return ret;
 
        spin_lock_irqsave(&vchan->vc.lock, flags);