dmaengine: fsl-edma: fix calculation of remaining bytes
authorStefan Agner <stefan@agner.ch>
Thu, 13 Nov 2014 11:56:02 +0000 (12:56 +0100)
committerVinod Koul <vinod.koul@intel.com>
Mon, 8 Dec 2014 13:13:44 +0000 (18:43 +0530)
If the current transfer control descriptor (TCD) was not yet started,
the address will be the same as the initial address. Hence test if the
current address is less than or equal to the start address of each TCD.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
drivers/dma/fsl-edma.c

index 3c5711d..58c6fc7 100644 (file)
@@ -386,7 +386,7 @@ static size_t fsl_edma_desc_residue(struct fsl_edma_chan *fsl_chan,
                                        &(edesc->tcd[i].vtcd->daddr));
 
                len -= size;
-               if (cur_addr > dma_addr && cur_addr < dma_addr + size) {
+               if (cur_addr >= dma_addr && cur_addr < dma_addr + size) {
                        len += dma_addr + size - cur_addr;
                        break;
                }