Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7150792ybi; Mon, 8 Jul 2019 15:40:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJGuK9a3eFLr3aE22ocZbhFEDYvHvINgs/GPbrMbB4FKBK3YhXApLnvVnma7sEM7uRDfOU X-Received: by 2002:a65:5888:: with SMTP id d8mr26093689pgu.124.1562625607151; Mon, 08 Jul 2019 15:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625607; cv=none; d=google.com; s=arc-20160816; b=DkRa2GGVwpySc4yv+qJ2B0PPVxXp5hUQlhkniVn29F2JAKqjuUJMd7iIh6wNSwDBWK 1p/PZD/FDAhbp977C0DCO2fZfjBfiRrICCdAIPT2TXTEHk4dhoOFhInf6PxEAPNfSVJS N/kCMmbj0RVIdrzNeD6il39FUIN5bf7dRxcgQgqBXwKR7FOdvv8MfclTCLANjxJYHM+O rTCyN9Uf6VsvW6ogFY+PSSugRAeUMXVgwTnRWs1Ypg2CDSkRIW4imRZrmdlOuTYQE2yK AFQ/HaoF9jniu4I4NkLzx6intgzCub1jg5DK1fC5cz6EaGazteirxS+vxlMNOvlWFkat ga0g== 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=qo9039p85MDSQo3iGXKPvo17/KbBKkPTC83uecRplOo2/5hJ5Ce1tiD0U6vDSg82Mq lL75p0ZdMk0HMqTcfOLVVw3Z5vCjblGcE/9XSqI1DBHKVIVsVqYUxlOZfOF/tw/Fk0KA ybx2Z1mecwKb2fHdr36z5NXeVEl28ksRV2hm7pMomPgxoFe5QUEa1NoDmbuhm/Dqv27v lFTI95VHaDtH+oq1MislcCk7IhccgVmoDKkwT3pFi4u9ob8RLoklAE658c0OMFiBPE8m ZjlhgI7oOTGVQ2NzJSX3ddNPzX4Oc6Lh+WVOqYId57mQA2Ac2ZxreaC5UxENuXWQwRv9 QRug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u8crBwuX; 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 u9si723165pjn.86.2019.07.08.15.39.52; Mon, 08 Jul 2019 15:40:07 -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=u8crBwuX; 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 S1733280AbfGHPfQ (ORCPT + 99 others); Mon, 8 Jul 2019 11:35:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:37686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733247AbfGHPfM (ORCPT ); Mon, 8 Jul 2019 11:35:12 -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 A6DA020651; Mon, 8 Jul 2019 15:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562600111; bh=TSKGw1r5dLtQbJRCdmKWf5HSmP9FklzelECTG9HgAjA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u8crBwuXzcpyHUJz1KH5Ak7VxTZVd0OO1/4x2a1h0BROC2zsrxIrfXMqn1U4e2Vo2 lvuPu/5l+75k41URLzvcDJpumCGbi+yU8IL98iTUIjPoQzeCfEm28Xb6XoFhWnhh9I r6T8J0cOxzxQiAz3jMsJh3EmuAalBkHF5AZ9JtuU= 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 5.1 92/96] dmaengine: qcom: bam_dma: Fix completed descriptors count Date: Mon, 8 Jul 2019 17:14:04 +0200 Message-Id: <20190708150531.411233629@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150526.234572443@linuxfoundation.org> References: <20190708150526.234572443@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 */