Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] serial: 8250: check DMA channel configuration errors
@ 2026-10-21 21:18 James Hilliard
  2026-10-21 21:28 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: James Hilliard @ 2026-10-21 21:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Heikki Krogerus
  Cc: linux-kernel, linux-serial, James Hilliard

serial8250_request_dma() checks channel capabilities but ignores the
result of configuring either channel. Those checks do not establish
that the provider accepted the requested slave configuration. If it
rejects the configuration, startup still selects DMA and later attempts
transfers on a channel that was not configured successfully.

Return the configuration error after releasing the channels acquired so
far. Both the common and OMAP startup paths already fall back to PIO when
requesting DMA fails. Check configuration before allocating the receive
buffer or mapping the transmit buffer, using the existing unwind paths.

Fixes: 9ee4b83e51f7 ("serial: 8250: Add support for dmaengine")
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 drivers/tty/serial/8250/8250_dma.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8250_dma.c
index 1da605cc8601..d6cda9a121c2 100644
--- a/drivers/tty/serial/8250/8250_dma.c
+++ b/drivers/tty/serial/8250/8250_dma.c
@@ -262,7 +262,9 @@ int serial8250_request_dma(struct uart_8250_port *p)
 		goto release_rx;
 	}
 
-	dmaengine_slave_config(dma->rxchan, &dma->rxconf);
+	ret = dmaengine_slave_config(dma->rxchan, &dma->rxconf);
+	if (ret)
+		goto release_rx;
 
 	/* Get a channel for TX */
 	dma->txchan = dma_request_slave_channel_compat(mask,
@@ -282,7 +284,9 @@ int serial8250_request_dma(struct uart_8250_port *p)
 		goto err;
 	}
 
-	dmaengine_slave_config(dma->txchan, &dma->txconf);
+	ret = dmaengine_slave_config(dma->txchan, &dma->txconf);
+	if (ret)
+		goto err;
 
 	rx_dev = dmaengine_get_dma_device(dma->rxchan);
 	tx_dev = dmaengine_get_dma_device(dma->txchan);

---
base-commit: 1184f87e2790e8af9be3116f608d2e86b4792d7d
change-id: 20261021-submit-serial-8250-dma-config-errors-v1-d536630f0c9d

Best regards,
--  
James Hilliard <james.hilliard1@gmail.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] serial: 8250: check DMA channel configuration errors
  2026-10-21 21:18 [PATCH] serial: 8250: check DMA channel configuration errors James Hilliard
@ 2026-10-21 21:28 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-21 21:28 UTC (permalink / raw)
  To: James Hilliard; +Cc: linux-serial

> serial8250_request_dma() checks channel capabilities but ignores the
> result of configuring either channel. Those checks do not establish
> that the provider accepted the requested slave configuration. If it
> rejects the configuration, startup still selects DMA and later attempts
> transfers on a channel that was not configured successfully.
> 
> Return the configuration error after releasing the channels acquired so
> far. Both the common and OMAP startup paths already fall back to PIO when
> requesting DMA fails. Check configuration before allocating the receive
> buffer or mapping the transmit buffer, using the existing unwind paths.
> 
> Fixes: 9ee4b83e51f7 ("serial: 8250: Add support for dmaengine")
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261021-submit-serial-8250-dma-config-errors-v1-v1-1-c067587d1ef2@gmail.com?part=1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-21 21:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-21 21:18 [PATCH] serial: 8250: check DMA channel configuration errors James Hilliard
2026-10-21 21:28 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox