]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dmaengine: sprd: Fix the last link-list configuration
authorEric Long <eric.long@spreadtrum.com>
Tue, 6 Nov 2018 05:01:33 +0000 (13:01 +0800)
committerVinod Koul <vkoul@kernel.org>
Wed, 5 Dec 2018 08:57:11 +0000 (14:27 +0530)
We will pass sglen as 0 configure the last link-list configuration
when filling the descriptor, which will cause the incorrect link-list
configuration. Thus we should check if the sglen is 0 to configure
the correct link-list configuration.

Signed-off-by: Eric Long <eric.long@spreadtrum.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/sprd-dma.c

index 4f3587b826da334127e9d5d0d6c2500ad6ea2bef..e6a74dc7da958d116ff12c8ffc3b6d1c9eef2fc9 100644 (file)
@@ -697,7 +697,8 @@ static int sprd_dma_fill_desc(struct dma_chan *chan,
                hw->cfg |= SPRD_DMA_LINKLIST_EN;
 
                /* link-list index */
-               temp = (sg_index + 1) % sglen;
+               temp = sglen ? (sg_index + 1) % sglen : 0;
+
                /* Next link-list configuration's physical address offset */
                temp = temp * sizeof(*hw) + SPRD_DMA_CHN_SRC_ADDR;
                /*