From patchwork Sat Sep 29 05:49:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "\(Exiting\) Baolin Wang" X-Patchwork-Id: 147817 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1575280lji; Fri, 28 Sep 2018 22:50:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV63etH0umyVFC8aTDKuViKbUsTu9UgkVgiCjbXqSz1S6ffZnui6panSVUsAN6ypnX+DZIa66 X-Received: by 2002:a62:670a:: with SMTP id b10-v6mr1718038pfc.243.1538200213715; Fri, 28 Sep 2018 22:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538200213; cv=none; d=google.com; s=arc-20160816; b=wq4swtddofLbFM6mXJql+OyGLqykxAoBU5NMMEz94sHhEO4zeW+X3Hi9iA7lAVzzeP c8AZIFSCnTVAqidWUrcT7KOzEkogtsJUEKSd1kz7EMIZ2nB3vFXerXgXJGq7YrwZzV+S WwcmieYiEVL1iHzIAfzo7oMBE9OlLTNP2o869Ha3+TnmfO+2pQ+tHcU8DpmmY9GOQxnh dlsU8rdv7/7edbO/KjOOa5kG1h7sgzIHbjdC3KRDTn+0HqJlgJXOHdCuF+G11ETb1Rwi e8k5nne//3Jhw9JSa95oNnczeLMGtEQqqMZOvvtv94JqdsepIwWowkbn+E+BUkf+WU+5 YWRg== 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 d36-v6si6848259pla.446.2018.09.28.22.50.13; Fri, 28 Sep 2018 22:50:13 -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 S1727551AbeI2MRO (ORCPT + 32 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(-) -- 1.7.9.5 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; /*