DMA Engine development
 help / color / mirror / Atom feed
From: Olivier Dautricourt <olivierdautricourt@gmail.com>
To: Stefan Roese <sr@denx.de>, Vinod Koul <vkoul@kernel.org>
Cc: linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org,
	Eric Schwarz <eas@sw-optimization.com>,
	Olivier Dautricourt <olivierdautricourt@gmail.com>
Subject: [PATCH v2 3/3] dmaengine: altera-msgdma: properly free descriptor in msgdma_free_descriptor
Date: Sat,  8 Jun 2024 23:31:48 +0200	[thread overview]
Message-ID: <20240608213216.25087-3-olivierdautricourt@gmail.com> (raw)
In-Reply-To: <20240608213216.25087-1-olivierdautricourt@gmail.com>

Remove list_del call in msgdma_chan_desc_cleanup, this should be the role
of msgdma_free_descriptor. In consequence replace list_add_tail with
list_move_tail in msgdma_free_descriptor.

This fixes the path:
   msgdma_free_chan_resources -> msgdma_free_descriptors ->
   msgdma_free_desc_list -> msgdma_free_descriptor

which does not correctly free the descriptors as first nodes were not
removed from the list.

Signed-off-by: Olivier Dautricourt <olivierdautricourt@gmail.com>
Tested-by: Olivier Dautricourt <olivierdautricourt@gmail.com>
---
 drivers/dma/altera-msgdma.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
index f32453c97dac..0968176f323d 100644
--- a/drivers/dma/altera-msgdma.c
+++ b/drivers/dma/altera-msgdma.c
@@ -233,7 +233,7 @@ static void msgdma_free_descriptor(struct msgdma_device *mdev,
 	struct msgdma_sw_desc *child, *next;
 
 	mdev->desc_free_cnt++;
-	list_add_tail(&desc->node, &mdev->free_list);
+	list_move_tail(&desc->node, &mdev->free_list);
 	list_for_each_entry_safe(child, next, &desc->tx_list, node) {
 		mdev->desc_free_cnt++;
 		list_move_tail(&child->node, &mdev->free_list);
@@ -590,8 +590,6 @@ static void msgdma_chan_desc_cleanup(struct msgdma_device *mdev)
 	list_for_each_entry_safe(desc, next, &mdev->done_list, node) {
 		struct dmaengine_desc_callback cb;
 
-		list_del(&desc->node);
-
 		dmaengine_desc_get_callback(&desc->async_tx, &cb);
 		if (dmaengine_desc_callback_valid(&cb)) {
 			spin_unlock_irqrestore(&mdev->lock, irqflags);
-- 
2.45.0


  parent reply	other threads:[~2024-06-08 21:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-08 21:31 [PATCH v2 1/3] dmaengine: altera-msgdma: use irq variant of spin_lock/unlock while invoking callbacks Olivier Dautricourt
2024-06-08 21:31 ` [PATCH v2 2/3] dmaengine: altera-msgdma: cleanup after completing all descriptors Olivier Dautricourt
2024-06-09 17:20   ` Markus Elfring
2024-06-09 20:33     ` Olivier Dautricourt
2024-06-08 21:31 ` Olivier Dautricourt [this message]
2024-06-09 17:30   ` [PATCH v2 3/3] dmaengine: altera-msgdma: properly free descriptor in msgdma_free_descriptor Markus Elfring
2024-06-09 20:36     ` Olivier Dautricourt
2024-06-09 15:50 ` [PATCH v2 1/3] dmaengine: altera-msgdma: use irq variant of spin_lock/unlock while invoking callbacks Markus Elfring
2024-06-11 18:28 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240608213216.25087-3-olivierdautricourt@gmail.com \
    --to=olivierdautricourt@gmail.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=eas@sw-optimization.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sr@denx.de \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox