Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7150987ybi; Mon, 8 Jul 2019 15:40:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqw2T7sK2nDPNSD2LkZ/898OQf7m4QI5kykcWFvayMxDoJt8lQ+FXegX/17zW9VmbQ5hZinK X-Received: by 2002:a17:902:9a95:: with SMTP id w21mr27699694plp.126.1562625622993; Mon, 08 Jul 2019 15:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625622; cv=none; d=google.com; s=arc-20160816; b=Om+8T5IuebfQBAkKi3Tan1nvQTzC7OYWJO6CXjQOWFmjZ9OeX6pqFYCeX/EE7vBpuR HUiMqoXqn2NHcoqduN/LmCsKXZEDjMNoXU5hBSkxrGixtoS4yCI8k7X3dCvsDhzKlIct eXNM3nbpdcFi68gWo0D37hfdk7h2ZCFJkqXa0MH0fLAi/L8ew9BTjdZhLw4DjilTqqKG COLP65ermQDZsi4sQecIp3zhaqExPq47A+2MJrENZv+vheAnWkD+x+Y80RgE4t91Epzm TpdbvB9f2PjdDsHlZzeh3Q9cfj5dBOHJtVgFibHrtalnKUXWocUqPB7z79auN2HNBuVP 8klQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=aAnP9Z/2YcO05/M7oLv+VB0YGiUASHfbbSqkeLNf0mE=; b=hZU2ZT6tYZbrHfZdRZFS6PIi4p2NHP6CBG/yP6eOoDVkX+eegCeKaAIrSreUr5/ORd CWexqsNymO+scT48y/9ecVpobjpxMeTPlj8w5FWJBAzQZ6k/qmF/hUOyTmxhiA3ZUXDs swpHOQzGNhDSLtIMRo7BCtBGns6z9RvgCkO04+Lo3Ddtpf0Y1P/IstB2jsjKoj+Fpg2r SW6Asz4w08uXKcPVBCPS+Wc8482WTlA6fPvgblhhQuQJRNh5+jX9v2StMBVI1qB1CPJA bZBD9VTV02iYKWuhj/jYF5M7qQ9seXyc4hpVZFNgxxw1SyW+aBZXr3pkbXpejEzzyeIR a1dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qgZfkfXY; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 18si20669329pgf.457.2019.07.08.15.40.08; Mon, 08 Jul 2019 15:40:22 -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=@kernel.org header.s=default header.b=qgZfkfXY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388212AbfGHPiR (ORCPT + 99 others); Mon, 8 Jul 2019 11:38:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:59666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389649AbfGHPaj (ORCPT ); Mon, 8 Jul 2019 11:30:39 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0F90521537; Mon, 8 Jul 2019 15:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599838; bh=TSKGw1r5dLtQbJRCdmKWf5HSmP9FklzelECTG9HgAjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qgZfkfXY0XbGKfxsXZnwLi8u9lwUgkygkjSfepjCkZGOk0Lb9oX1J+jJvio0c6NI1 dbVjjTlyrEMWR51kbGdUz2oF+OPP/HdcjK72zqoNTXom4BJlIN5FzPPFv6FS/aI+YO 63vYKFpyTHo7fCnfEctPpWvejY3SePzjyRiwLdPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Sricharan R , Vinod Koul Subject: [PATCH 4.19 89/90] dmaengine: qcom: bam_dma: Fix completed descriptors count Date: Mon, 8 Jul 2019 17:13:56 +0200 Message-Id: <20190708150527.042392553@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150521.829733162@linuxfoundation.org> References: <20190708150521.829733162@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sricharan R commit f6034225442c4a87906d36e975fd9e99a8f95487 upstream. One space is left unused in circular FIFO to differentiate 'full' and 'empty' cases. So take that in to account while counting for the descriptors completed. Fixes the issue reported here, https://lkml.org/lkml/2019/6/18/669 Cc: stable@vger.kernel.org Reported-by: Srinivas Kandagatla Signed-off-by: Sricharan R Tested-by: Srinivas Kandagatla Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/qcom/bam_dma.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/dma/qcom/bam_dma.c +++ b/drivers/dma/qcom/bam_dma.c @@ -808,6 +808,9 @@ static u32 process_channel_irqs(struct b /* Number of bytes available to read */ avail = CIRC_CNT(offset, bchan->head, MAX_DESCRIPTORS + 1); + if (offset < bchan->head) + avail--; + list_for_each_entry_safe(async_desc, tmp, &bchan->desc_list, desc_node) { /* Not enough data to read */