[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250913153423.1030647-1-zilin@seu.edu.cn>
Date: Sat, 13 Sep 2025 15:34:23 +0000
From: Zilin Guan <zilin@....edu.cn>
To: vkoul@...nel.org
Cc: dmaengine@...r.kernel.org,
linux-kernel@...r.kernel.org,
jianhao.xu@....edu.cn,
Zilin Guan <zilin@....edu.cn>
Subject: [PATCH V2] drivers/dma: replace dma_free_coherent with dma_free_wc
The DMA descriptor pool is allocated with dma_alloc_wc but freed with
dma_free_coherent in the error handling path. This mismatch prevents
the resource from being released properly and may lead to memory leaks
or other issues.
Fix this by freeing the DMA descriptor pool with dma_free_wc to match
the dma_alloc_wc allocation.
Fixes: b503fa01990f ("dma: mv_xor: remove the pool_size from platform_data")
Signed-off-by: Zilin Guan <zilin@....edu.cn>
---
Changes in v2:
- Fix the incorrect description in the commit log.
- Add "Fixes" tag accordingly.
drivers/dma/mv_xor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 1fdcb0f5c9e7..58de208fc50d 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1163,7 +1163,7 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
err_free_irq:
free_irq(mv_chan->irq, mv_chan);
err_free_dma:
- dma_free_coherent(&pdev->dev, MV_XOR_POOL_SIZE,
+ dma_free_wc(&pdev->dev, MV_XOR_POOL_SIZE,
mv_chan->dma_desc_pool_virt, mv_chan->dma_desc_pool);
err_unmap_dst:
dma_unmap_single(dma_dev->dev, mv_chan->dummy_dst_addr,
--
2.34.1
Powered by blists - more mailing lists