From: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Thomas Fourier <fourier.thomas@gmail.com>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
Olof Johansson <olof@lixom.net>, Jeff Garzik <jeff@garzik.org>,
linuxppc-dev@lists.ozlabs.org (open list:LINUX FOR POWERPC
(32-BIT AND 64-BIT)), linux-kernel@vger.kernel.org (open list)
Subject: [PATCH] powerpc/pasemi: Fix pasemi_dma_free_buf()
Date: Thu, 26 Nov 2026 09:16:27 +0100 [thread overview]
Message-ID: <20261126081637.13160-2-fourier.thomas@gmail.com> (raw)
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
reply other threads:[~2026-11-26 8:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126081637.13160-2-fourier.thomas@gmail.com \
--to=fourier.thomas@gmail.com \
--cc=chleroy@kernel.org \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=olof@lixom.net \
--cc=ritesh.list@gmail.com \
--cc=sshegde@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®