Skip to content

Commit 8fef76f

Browse files
Yuuoniygregkh
authored andcommitted
serial: amba-pl011: prefer dma_mapping_error() over explicit address checking
commit eb4917f upstream. 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 fa03081 ("ALSA: memalloc: prefer dma_mapping_error() over explicit address checking") Fixes: 58ac1b3 ("ARM: PL011: Fix DMA support") Cc: stable <stable@kernel.org> Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com> Link: https://patch.msgid.link/20251027092053.87937-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 05f5e26 commit 8fef76f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/tty/serial/amba-pl011.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap)
618618
dmatx->len = count;
619619
dmatx->dma = dma_map_single(dma_dev->dev, dmatx->buf, count,
620620
DMA_TO_DEVICE);
621-
if (dmatx->dma == DMA_MAPPING_ERROR) {
621+
if (dma_mapping_error(dma_dev->dev, dmatx->dma)) {
622622
uap->dmatx.queued = false;
623623
dev_dbg(uap->port.dev, "unable to map TX DMA\n");
624624
return -EBUSY;

0 commit comments

Comments
 (0)