mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Hilliard <james.hilliard1@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>,
	 Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	 James Hilliard <james.hilliard1@gmail.com>
Subject: [PATCH] serial: 8250: check DMA channel configuration errors
Date: Wed, 21 Oct 2026 15:18:48 -0600	[thread overview]
Message-ID: <20261021-submit-serial-8250-dma-config-errors-v1-v1-1-c067587d1ef2@gmail.com> (raw)

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>


                 reply	other threads:[~2026-10-21 21:18 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=20261021-submit-serial-8250-dma-config-errors-v1-v1-1-c067587d1ef2@gmail.com \
    --to=james.hilliard1@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /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®