summaryrefslogtreecommitdiff
path: root/drivers/dma/sprd-dma.c
diff options
context:
space:
mode:
authorEric Long <eric.long@spreadtrum.com>2018-11-06 08:01:33 +0300
committerVinod Koul <vkoul@kernel.org>2018-12-05 11:57:11 +0300
commit13e8997924a0df7f0136d742aa829b791889d3ce (patch)
treebce9d4a8157e6b529c5859fff7c97b5883d9ddf8 /drivers/dma/sprd-dma.c
parentd762ab33ccd03e8c1ad50b814d2deccec15b8c28 (diff)
downloadlinux-13e8997924a0df7f0136d742aa829b791889d3ce.tar.xz
dmaengine: sprd: Fix the last link-list configuration
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>
Diffstat (limited to 'drivers/dma/sprd-dma.c')
-rw-r--r--drivers/dma/sprd-dma.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index 4f3587b826da..e6a74dc7da95 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -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;
/*