Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1421587imu; Mon, 5 Nov 2018 21:02:54 -0800 (PST) X-Google-Smtp-Source: AJdET5c5m7DeOsdIWM3cMcoSrfJfYaSYyW0cfSv6D98+/XjrrZB9bcc+8miavFmPiDjW47p9gzyW X-Received: by 2002:a17:902:8d94:: with SMTP id v20-v6mr25211886plo.109.1541480574667; Mon, 05 Nov 2018 21:02:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541480574; cv=none; d=google.com; s=arc-20160816; b=rFzGALNtAFE24pf8djZjxkLVxELIBD6kgeEAEfLGFgC7/jpNzwNg9qULEsVwD0h8VJ JBKaiNcCHXLM7a79xyL01/mWYJwnyk4DXdZhFr/5wyMnfYhoLuMIzYA0MiiBguFe+gh6 lq5KxAetZ5R6sKPWQhqdMiypp3h6DeCKBS7Sy+AR15PBcnwC2br389NlV1BiLpg2aHJ7 8AxE0HuEnk1IFxI25MlKzLrnPIrM61Xis+gF/uZVHDMoaylDHRhf51Jj2yKk0IxEKYDn CorOneIs0c8dBQqyrBJdPycScsjRMSEw/hHKCAwcnh7k7SYqeOdJj6GvUzyXKFeBLcah UJMw== 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=pA5Q+n2+haTzspPorBVLs74PdryJv0DJVFiobOb1UcsIidaNm2/tiP9EcWJ7bycyRh ytzSQ0QoeMrkfhMRXp4VwpV6Ew2hyk7OduSdaNeQPK3q1zJdtB7L+TSsdBd1As6yrDqx y71c/OMDVhYr6l7R88kAg0ksIhVD0KJaqGRTKuT8YfgK3WLmPLMJAe6mATwQQSSaT8mR sOJQP6azxcHVcjHoqmm1Evc4wgGHyQ04vILywx//ofuXnzcRVNrIwS+5fUcMl9dOGmdG jOZ8WrTk71TXMOT7XWnsG1AzbOzGv0ox0FzAGej6/odJe3JoZz6nIyLD55q1hnGs8gsc Riyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gutae7G7; 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 x9si3023774pgh.12.2018.11.05.21.02.39; Mon, 05 Nov 2018 21:02:54 -0800 (PST) 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=gutae7G7; 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 S1729821AbeKFOZb (ORCPT + 99 others); Tue, 6 Nov 2018 09:25:31 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:40509 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729794AbeKFOZb (ORCPT ); Tue, 6 Nov 2018 09:25:31 -0500 Received: by mail-pl1-f194.google.com with SMTP id q19-v6so2579118pll.7 for ; Mon, 05 Nov 2018 21:02:09 -0800 (PST) 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=gutae7G74a5xWjvogNtC3uF7yCVomb6SNDj4i/rOZwIqyQrrPMcLKpUVx0rsnX15Ju kE3KVj6sicYEePLve7JYvmafJCZsUduo0QgnTSQFHG2AvthQXdg3uIeN7/WCdzg61MOC MlSY9nCD6TpzzC31M86yCd7b1Xa81FTIzHdoM= 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=FHRu2RaHfNhOfxaoBm1wxElg6JRsBZ/GJ3Xn5ZCLGjlSwdTEY7nc0WwFIy0fD1LDeM xPANDb4IWwxoKoAE3Ychs2Dbfzv82g/lA6NOTpwMNT/ERgxKHqkovmCW6xinlAeAQNm8 O9A0Bss6K7AEx+Tf+aeCOfkK7Xv+gvIto6F8OSPK/LygSVDT1ElnVer07UBGBpE1aFjE shNVmAb9hOQuOTPgfN4WJ/fH9dpKIhlqHLrSUDBt5G6Y7cs29E+RGT4Hntq66q47vrZY 2hniYaX2E2jwbhaZIUUmdt50mcg3nctMYbsYWM2qQ+Z6g0lVn2kK+735embwbOiKonAc tANQ== X-Gm-Message-State: AGRZ1gIPAiTodEn1L5ukZko0qtJ7uPFFhUQFFKCAi/iQ3Vrl0QJ8Jh1z bNgzQZcK+3bmWKXFxuLt/I5kEQ== X-Received: by 2002:a17:902:4222:: with SMTP id g31-v6mr24679107pld.236.1541480528979; Mon, 05 Nov 2018 21:02:08 -0800 (PST) Received: from baolinwangubtpc.spreadtrum.com ([117.18.48.102]) by smtp.gmail.com with ESMTPSA id o7-v6sm55735416pfb.23.2018.11.05.21.02.06 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Nov 2018 21:02:08 -0800 (PST) From: Baolin Wang To: dan.j.williams@intel.com, vkoul@kernel.org, eric.long@unisoc.com Cc: broonie@kernel.org, baolin.wang@linaro.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH 3/7] dmaengine: sprd: Fix the last link-list configuration Date: Tue, 6 Nov 2018 13:01:33 +0800 Message-Id: <95cbea4b835bb2689036afe78ff0b2239a24f352.1541480353.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