From: Gregory CLEMENT <gregory.clement@bootlin.com>
To: Miaoqian Lin <linmq006@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Nam Cao <namcao@linutronix.de>,
Toshiyuki Sato <fj6611ie@aa.jp.fujitsu.com>,
Miroslav Ondra <ondra@faster.cz>,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org
Cc: linmq006@gmail.com, stable@vger.kernel.org
Subject: Re: [PATCH] serial: amba-pl011: prefer dma_mapping_error() over explicit address checking
Date: Mon, 27 Oct 2025 16:04:19 +0100 [thread overview]
Message-ID: <87a51ce68c.fsf@BLaptop.bootlin.com> (raw)
In-Reply-To: <20251027092053.87937-1-linmq006@gmail.com>
Miaoqian Lin <linmq006@gmail.com> writes:
> Check for returned DMA addresses using specialized dma_mapping_error()
> helper which is generally recommended for this purpose by
> Documentation/core-api/dma-api.rst:
>
> "In some circumstances dma_map_single(), ...
> will fail to create a mapping. A driver can check for these errors
> by testing the returned DMA address with dma_mapping_error()."
>
> Found via static analysis and this is similar to commit fa0308134d26
> ("ALSA: memalloc: prefer dma_mapping_error() over explicit address checking")
>
> Fixes: 58ac1b379979 ("ARM: PL011: Fix DMA support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Thanks,
Gregory
> ---
> drivers/tty/serial/amba-pl011.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
> index 22939841b1de..7f17d288c807 100644
> --- a/drivers/tty/serial/amba-pl011.c
> +++ b/drivers/tty/serial/amba-pl011.c
> @@ -628,7 +628,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
> dmatx->len = count;
> dmatx->dma = dma_map_single(dma_dev->dev, dmatx->buf, count,
> DMA_TO_DEVICE);
> - if (dmatx->dma == DMA_MAPPING_ERROR) {
> + if (dma_mapping_error(dma_dev->dev, dmatx->dma)) {
> uap->dmatx.queued = false;
> dev_dbg(uap->port.dev, "unable to map TX DMA\n");
> return -EBUSY;
> --
> 2.39.5 (Apple Git-154)
>
--
Grégory CLEMENT, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2025-10-27 15:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-27 9:20 [PATCH] serial: amba-pl011: prefer dma_mapping_error() over explicit address checking Miaoqian Lin
2025-10-27 15:04 ` Gregory CLEMENT [this message]
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=87a51ce68c.fsf@BLaptop.bootlin.com \
--to=gregory.clement@bootlin.com \
--cc=arnd@arndb.de \
--cc=fj6611ie@aa.jp.fujitsu.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mingo@kernel.org \
--cc=namcao@linutronix.de \
--cc=ondra@faster.cz \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).