* [PATCH] powerpc/pasemi: Fix pasemi_dma_free_buf()
@ 2026-11-26 8:16 Thomas Fourier
0 siblings, 0 replies; only message in thread
From: Thomas Fourier @ 2026-11-26 8:16 UTC (permalink / raw)
Cc: Thomas Fourier, Madhavan Srinivasan, Michael Ellerman,
Nicholas Piggin, Christophe Leroy (CS GROUP),
Ritesh Harjani (IBM),
Shrikanth Hegde, Olof Johansson, Jeff Garzik,
open list:LINUX FOR POWERPC (32-BIT AND 64-BIT),
open list
dma_free_coherent() is called with the wrong arguments. The two last
arguments must be the virtual address and the DMA address but the
DMA address and the allocation flags are passed. If this function were
called, it would call kfree() on a DMA address and dma_unmap() on the
allocation flag.
Add the buffer argument to pasemi_dma_free_buf() and pass the right
arguments to dma_free_coherent().
Fixes: 8ee9d8577935 ("pasemi: DMA engine management library")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
arch/powerpc/include/asm/pasemi_dma.h | 2 +-
arch/powerpc/platforms/pasemi/dma_lib.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/pasemi_dma.h b/arch/powerpc/include/asm/pasemi_dma.h
index 712a0b32120f..9285a38ff18a 100644
--- a/arch/powerpc/include/asm/pasemi_dma.h
+++ b/arch/powerpc/include/asm/pasemi_dma.h
@@ -508,7 +508,7 @@ extern void pasemi_dma_free_ring(struct pasemi_dmachan *chan);
extern void *pasemi_dma_alloc_buf(struct pasemi_dmachan *chan, int size,
dma_addr_t *handle);
extern void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size,
- dma_addr_t *handle);
+ void *buf, dma_addr_t *handle);
/* Routines to allocate flags (events) for channel synchronization */
extern int pasemi_dma_alloc_flag(void);
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c
index 1be1f18f6f09..d33feb32c0a1 100644
--- a/arch/powerpc/platforms/pasemi/dma_lib.c
+++ b/arch/powerpc/platforms/pasemi/dma_lib.c
@@ -356,14 +356,15 @@ EXPORT_SYMBOL(pasemi_dma_alloc_buf);
/* pasemi_dma_free_buf - Free a buffer used for DMA
* @chan: Channel the buffer was allocated for
* @size: Size of buffer in bytes
+ * @buf: Virtual address of the buffer
* @handle: DMA handle
*
* Frees a previously allocated buffer.
*/
-void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size,
+void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size, void *buf,
dma_addr_t *handle)
{
- dma_free_coherent(&dma_pdev->dev, size, handle, GFP_KERNEL);
+ dma_free_coherent(&dma_pdev->dev, size, buf, *handle);
}
EXPORT_SYMBOL(pasemi_dma_free_buf);
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-26 8:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-26 8:16 [PATCH] powerpc/pasemi: Fix pasemi_dma_free_buf() Thomas Fourier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®