Merge branch 'rcar-3.9.4/dmae.rc1' into v4.14.75-ltsi/rcar-3.9.6

* rcar-3.9.4/dmae.rc1:
  dmaengine: sh: rcar-dmac: With cyclic DMA residue 0 is valid
  Revert "dmaengine: sh: rcar-dmac: With cyclic DMA residue 0 is valid"
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 979efc6..66d73bff 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1397,6 +1397,7 @@
 	enum dma_status status;
 	unsigned long flags;
 	unsigned int residue;
+	bool cyclic;
 
 	status = dma_cookie_status(chan, cookie, txstate);
 	if (status == DMA_COMPLETE || !txstate)
@@ -1404,10 +1405,11 @@
 
 	spin_lock_irqsave(&rchan->lock, flags);
 	residue = rcar_dmac_chan_get_residue(rchan, cookie);
+	cyclic = rchan->desc.running ? rchan->desc.running->cyclic : false;
 	spin_unlock_irqrestore(&rchan->lock, flags);
 
 	/* if there's no residue, the cookie is complete */
-	if (!residue && !rchan->desc.running->cyclic)
+	if (!residue && !cyclic)
 		return DMA_COMPLETE;
 
 	dma_set_residue(txstate, residue);