Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1566088imm; Fri, 28 Sep 2018 22:50:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV61bNig5ku93NPZmv6DCOspX8glnATIg2Gq1dnf3ohKlQApOxYofUQ1/ZyBC4K17PPsnx5m8 X-Received: by 2002:a62:2a48:: with SMTP id q69-v6mr1744311pfq.86.1538200243537; Fri, 28 Sep 2018 22:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538200243; cv=none; d=google.com; s=arc-20160816; b=EAuRNY+lrQr+ZNPiCHe4ejSaQrwPDv2ok3GhTVYgTih+tFMXQsr5g9ddiZ4u9EhYDU xqEDcxCJAPujMwdreSoh3usCSiSebuYYTXU0QWeHwsORZL1O7YVxRnwvd4UWiQ5JswWD E23VY5UOyyrLXi0LKd4Y6B5bFw4jGD4X3m9OD10llqY9ysMvVChpOz1T1I8z4ggT1rKa cf2nWhyB2e2rxP/as8b5tgkHxxpXH1XsIBaVnK2aWXhULtZ/rBIpequkRsUs+rdxsDxI T6yFXD00Xv0XAXjFNIpMtCzEQBfcb0JyzDc3LIbctTFca+9MPuiz7zLSZgC/w49SLaac MBUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=Ipu0OKiVTAGWTLE4fg/nM2ymSy+8y5EVSd0lvjhlhp8=; b=mRrTMfLo30+jbv9BDCE2aO9ZFUsWXhpy/s2QoWzIauNF/pS/G2PI4dBuA1ZnKZNFZm A6LuXILt6kRnAdR3GnNnZKp+hSg2mHMnl8XetNQ5+Rgbu6u0zP4Hu48fZu/lxj+jFrDy YA6rAodMwPlZh7TQY7OHgLH7Iq6Pkko+qmp5e2n75v7LnRYMhOGr7JjcRyJsLvYOCVE6 xtcMlw0IIjg2XDeRIDlggjRrrKrQZBYUQT9NGAx/ltOmG6W+rftnJ4Pa45hdJ8q1+vUb WhJNrKK6HWoKhnohNw2m0rwEtAvW6cj1Hnh8TlOpvJ1DVtqO5LFNjW2FCDyeYSgDB8h7 nf0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YqOtdihF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a75-v6si6759223pfc.106.2018.09.28.22.50.29; Fri, 28 Sep 2018 22:50:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YqOtdihF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727540AbeI2MRO (ORCPT + 99 others); Sat, 29 Sep 2018 08:17:14 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:38240 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727528AbeI2MRN (ORCPT ); Sat, 29 Sep 2018 08:17:13 -0400 Received: by mail-pg1-f196.google.com with SMTP id r77-v6so5897406pgr.5 for ; Fri, 28 Sep 2018 22:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Ipu0OKiVTAGWTLE4fg/nM2ymSy+8y5EVSd0lvjhlhp8=; b=YqOtdihFkLN2j80Ggp47W6x2EUCNJKJd/quxmLhMX+oR42FFg7B4fxe0615eAXeWi5 HhSIDrOdGDmTKgjwroJ+6xo2GueD3HAG/8OgW8BJSQGodsehaqMRWy5Uy4QooYl74Qaq 7D2+jDJPkJWbqk/6HBNOk3C7tAmrgbG4EAYUo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=Ipu0OKiVTAGWTLE4fg/nM2ymSy+8y5EVSd0lvjhlhp8=; b=jXsyRibr4Cpm0ely4hCLZmO/TauCxb/ycD775woOo1K4ko01KT6nFzvfz9wJ2FOtP6 R7DVbl8YPfEuqQovV988qP+O/MBtbSHbGHi5AmHMfhVxWMg/9WekwcBSDWu0Vc3spHaF 1r+Y8ggme4c/pMx/RaogBuSn4ZIIaulVml41xsuHB0V7mR+VNmlAnfFRnDp2v4eVv+p7 rZJi3uV8Oiz3T/I3FX4UQVpOrJ/YhT9H2IZtr0/FoMTyyMU36Ts+jZP3u1jY5G5+g1Mm px/Quv1mFf4FcAdhSZwuDygAiqioG5XcH3I1iBB4kC3MhjYCaONqz2OqQQHssFZ/iSb9 d2/Q== X-Gm-Message-State: ABuFfoh0a4waDbaMZsiDxxKqsDGM8qcYC0s8vxq8lxVSdOo/6yiSiV95 XS3WV8orAYGxlugO/K0GirxRZg== X-Received: by 2002:a63:745e:: with SMTP id e30-v6mr1601662pgn.446.1538200209055; Fri, 28 Sep 2018 22:50:09 -0700 (PDT) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id i80-v6sm11118049pfi.87.2018.09.28.22.50.05 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Sep 2018 22:50:08 -0700 (PDT) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org, eric.long@spreadtrum.com Cc: broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] dmaengine: sprd: Fix the last link-list configuration Date: Sat, 29 Sep 2018 13:49:01 +0800 Message-Id: <9735715d9e9fb4e6fbbe19643db1ce80ef51d37a.1538199697.git.baolin.wang@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Long 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 Signed-off-by: Baolin Wang --- drivers/dma/sprd-dma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c index 4f3587b..e6a74dc 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; /* -- 1.7.9.5