[PATCH v2] powerpc/pasemi: Remove pasemi_dma_alloc_buf() and pasemi_dma_free_buf()

From: Thomas Fourier

Date: Fri Nov 27 2026 - 04:19:38 EST


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.

Remove pasemi_dma_alloc_buf() and pasemi_dma_free_buf() as these
functions are not used.

Fixes: 8ee9d8577935 ("pasemi: DMA engine management library")
Signed-off-by: Thomas Fourier <fourier.thomas@xxxxxxxxx>
---
v1->v2:
- remove the functions instead of fixing them

arch/powerpc/include/asm/pasemi_dma.h | 5 ----
arch/powerpc/platforms/pasemi/dma_lib.c | 31 -------------------------
2 files changed, 36 deletions(-)

diff --git a/arch/powerpc/include/asm/pasemi_dma.h b/arch/powerpc/include/asm/pasemi_dma.h
index 712a0b32120f..bb2c347dfec2 100644
--- a/arch/powerpc/include/asm/pasemi_dma.h
+++ b/arch/powerpc/include/asm/pasemi_dma.h
@@ -505,11 +505,6 @@ extern int pasemi_dma_stop_chan(const struct pasemi_dmachan *chan);
extern int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size);
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);
-
/* Routines to allocate flags (events) for channel synchronization */
extern int pasemi_dma_alloc_flag(void);
extern void pasemi_dma_free_flag(int flag);
diff --git a/arch/powerpc/platforms/pasemi/dma_lib.c b/arch/powerpc/platforms/pasemi/dma_lib.c
index 1be1f18f6f09..d6ce553c53bf 100644
--- a/arch/powerpc/platforms/pasemi/dma_lib.c
+++ b/arch/powerpc/platforms/pasemi/dma_lib.c
@@ -336,37 +336,6 @@ int pasemi_dma_stop_chan(const struct pasemi_dmachan *chan)
}
EXPORT_SYMBOL(pasemi_dma_stop_chan);

-/* pasemi_dma_alloc_buf - Allocate a buffer to use for DMA
- * @chan: Channel to allocate for
- * @size: Size of buffer in bytes
- * @handle: DMA handle
- *
- * Allocate a buffer to be used by the DMA engine for read/write,
- * similar to dma_alloc_coherent().
- *
- * Returns the virtual address of the buffer, or NULL in case of failure.
- */
-void *pasemi_dma_alloc_buf(struct pasemi_dmachan *chan, int size,
- dma_addr_t *handle)
-{
- return dma_alloc_coherent(&dma_pdev->dev, size, handle, GFP_KERNEL);
-}
-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
- * @handle: DMA handle
- *
- * Frees a previously allocated buffer.
- */
-void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size,
- dma_addr_t *handle)
-{
- dma_free_coherent(&dma_pdev->dev, size, handle, GFP_KERNEL);
-}
-EXPORT_SYMBOL(pasemi_dma_free_buf);
-
/* pasemi_dma_alloc_flag - Allocate a flag (event) for channel synchronization
*
* Allocates a flag for use with channel synchronization (event descriptors).
--
2.53.0