From: Karol Wachowski <karol.wachowski@linux.intel.com>
To: Lizhi Hou <lizhi.hou@amd.com>,
ogabbay@kernel.org, quic_jhugo@quicinc.com,
dri-devel@lists.freedesktop.org, mario.limonciello@amd.com,
maciej.falkowski@linux.intel.com
Cc: Wendy Liang <wendy.liang@amd.com>,
linux-kernel@vger.kernel.org, max.zhen@amd.com,
sonal.santan@amd.com
Subject: Re: [PATCH V1] accel/amdxdna: Return ERR_PTR on dma_alloc_noncoherent failure
Date: Mon, 23 Mar 2026 18:53:51 +0100 [thread overview]
Message-ID: <8735bc51-0774-49fd-bfe3-2c220f9f2f75@linux.intel.com> (raw)
In-Reply-To: <20260323173719.2311474-1-lizhi.hou@amd.com>
On 3/23/2026 6:37 PM, Lizhi Hou wrote:
> From: Wendy Liang <wendy.liang@amd.com>
>
> dma_alloc_noncoherent() returns NULL on failure, but callers of
> aie2_alloc_msg_buffer() check for IS_ERR(). Return ERR_PTR(-ENOMEM)
> instead of NULL to match the amdxdna_iommu_alloc() path and the
> caller's error checking convention.
>
> Fixes: ece3e8980907 ("accel/amdxdna: Allow forcing IOVA-based DMA via module parameter")
> Signed-off-by: Wendy Liang <wendy.liang@amd.com>
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
> ---
> drivers/accel/amdxdna/aie2_message.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/accel/amdxdna/aie2_message.c b/drivers/accel/amdxdna/aie2_message.c
> index 7e219a5eda56..a1c546c3e81c 100644
> --- a/drivers/accel/amdxdna/aie2_message.c
> +++ b/drivers/accel/amdxdna/aie2_message.c
> @@ -56,6 +56,7 @@ void *aie2_alloc_msg_buffer(struct amdxdna_dev_hdl *ndev, u32 *size,
> dma_addr_t *dma_addr)
> {
> struct amdxdna_dev *xdna = ndev->xdna;
> + void *vaddr;
> int order;
>
> *size = max(*size, SZ_8K);
> @@ -67,8 +68,12 @@ void *aie2_alloc_msg_buffer(struct amdxdna_dev_hdl *ndev, u32 *size,
> if (amdxdna_iova_on(xdna))
> return amdxdna_iommu_alloc(xdna, *size, dma_addr);
>
> - return dma_alloc_noncoherent(xdna->ddev.dev, *size, dma_addr,
> + vaddr = dma_alloc_noncoherent(xdna->ddev.dev, *size, dma_addr,
> DMA_FROM_DEVICE, GFP_KERNEL);
> + if (!vaddr)
> + return ERR_PTR(-ENOMEM);
> +
> + return vaddr;
> }
>
> void aie2_free_msg_buffer(struct amdxdna_dev_hdl *ndev, size_t size,
Reviewed-by: Karol Wachowski <karol.wachowski@linux.intel.com>
next prev parent reply other threads:[~2026-03-23 17:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 17:37 [PATCH V1] accel/amdxdna: Return ERR_PTR on dma_alloc_noncoherent failure Lizhi Hou
2026-03-23 17:53 ` Karol Wachowski [this message]
2026-03-23 17:56 ` Mario Limonciello (AMD) (kernel.org)
2026-03-23 20:36 ` Lizhi Hou
2026-03-24 21:38 ` Claude review: " Claude Code Review Bot
2026-03-24 21:38 ` Claude Code Review Bot
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=8735bc51-0774-49fd-bfe3-2c220f9f2f75@linux.intel.com \
--to=karol.wachowski@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=maciej.falkowski@linux.intel.com \
--cc=mario.limonciello@amd.com \
--cc=max.zhen@amd.com \
--cc=ogabbay@kernel.org \
--cc=quic_jhugo@quicinc.com \
--cc=sonal.santan@amd.com \
--cc=wendy.liang@amd.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