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: 10620637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5E42F15A6 for ; Sat, 29 Sep 2018 05:50:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50A0629CEB for ; Sat, 29 Sep 2018 05:50:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 451B12AFF5; Sat, 29 Sep 2018 05:50:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E651529CEB for ; Sat, 29 Sep 2018 05:50:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727530AbeI2MRO (ORCPT ); Sat, 29 Sep 2018 08:17:14 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:46096 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727505AbeI2MRN (ORCPT ); Sat, 29 Sep 2018 08:17:13 -0400 Received: by mail-pg1-f196.google.com with SMTP id b129-v6so5860717pga.13 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=ZmSHh5Xek14CuWKMT0cblkauQrCG1ecPBu+0NjOKfe8ABP7kIFY6WS+d5iSXp2xgNA IaKqRluDJFpsxvLN4Bk51Hgoe3COTPo6iehJ4zO1dCF58W/TrWDSPOhL5Z91HlfYrU2m n8bUH1ObV0RCR3QcyTttW0S8SQLNSS2sPQpnqftZaOl50rmlBUPjS5+2Rb2+5EgnYb6m b6+c1bREbzsEPAwD6ZU+ZjZxpEIq06AZUsEqPLmo7XauULZnIaUw43bxRlKB+pfCVqRg KEAPttamLbXqzqlEUFqj+f/BhK1jVTO9iWMgx8gFQdp9E+MHse4DLqgnOvpsI5gw0akH Dekw== X-Gm-Message-State: ABuFfogTVv5eo7StCpa+9RRwv71ZiZL0w8eytCoAzUY0bPapOz9sRRo0 K9Am1wDISg14jnuUYb0MLJRlAQ== X-Google-Smtp-Source: ACcGV63pv1dqyvWBPMPKI3lGYcudnq3PmhlPxU230Vdmb3ZFbYCG8OfXSE7wQFHgfHDg4/27lJdchQ== 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: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; /*