Skip to content

Commit 20bf292

Browse files
Olivier Dautricourtgregkh
authored andcommitted
dmaengine: altera-msgdma: properly free descriptor in msgdma_free_descriptor
[ Upstream commit 54e4ada ] 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 <[email protected]> Tested-by: Olivier Dautricourt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent cd3851e commit 20bf292

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/dma/altera-msgdma.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ static void msgdma_free_descriptor(struct msgdma_device *mdev,
233233
struct msgdma_sw_desc *child, *next;
234234

235235
mdev->desc_free_cnt++;
236-
list_add_tail(&desc->node, &mdev->free_list);
236+
list_move_tail(&desc->node, &mdev->free_list);
237237
list_for_each_entry_safe(child, next, &desc->tx_list, node) {
238238
mdev->desc_free_cnt++;
239239
list_move_tail(&child->node, &mdev->free_list);
@@ -588,8 +588,6 @@ static void msgdma_chan_desc_cleanup(struct msgdma_device *mdev)
588588
list_for_each_entry_safe(desc, next, &mdev->done_list, node) {
589589
struct dmaengine_desc_callback cb;
590590

591-
list_del(&desc->node);
592-
593591
dmaengine_desc_get_callback(&desc->async_tx, &cb);
594592
if (dmaengine_desc_callback_valid(&cb)) {
595593
spin_unlock_irqrestore(&mdev->lock, irqflags);

0 commit comments

Comments
 (0)