summaryrefslogtreecommitdiff
path: root/drivers/dma/altera-msgdma.c
diff options
context:
space:
mode:
authorOlivier Dautricourt <olivierdautricourt@gmail.com>2024-06-08 23:31:48 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-09-08 07:54:46 +0200
commit20bf2920a869f9dbda0ef8c94c87d1901a64a716 (patch)
tree1fce7b9704316d0b1e4813a91bbc94a45fbb3584 /drivers/dma/altera-msgdma.c
parentcd3851ef3f7d58259bab7c4ebcb4742040694625 (diff)
downloadlinux-rpi-20bf2920a869f9dbda0ef8c94c87d1901a64a716.tar.gz
linux-rpi-20bf2920a869f9dbda0ef8c94c87d1901a64a716.tar.bz2
linux-rpi-20bf2920a869f9dbda0ef8c94c87d1901a64a716.zip
dmaengine: altera-msgdma: properly free descriptor in msgdma_free_descriptor
[ Upstream commit 54e4ada1a4206f878e345ae01cf37347d803d1b1 ] 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> Link: https://lore.kernel.org/r/20240608213216.25087-3-olivierdautricourt@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/dma/altera-msgdma.c')
-rw-r--r--drivers/dma/altera-msgdma.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/dma/altera-msgdma.c b/drivers/dma/altera-msgdma.c
index 8c479a3676fc..711e3756a39a 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);
@@ -588,8 +588,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);