[PATCH] serial: pch_uart: allow DMA channel lookup with modular PCH DMA

From: Pengpeng Hou

Date: Thu Dec 03 2026 - 21:34:47 EST


When PCH DMA is built as a module, pch_uart_verify_port() returns
-EOPNOTSUPP before attempting to acquire a DMA channel.

Test IS_ENABLED instead. This lets the driver look for channels when the
DMA provider is modular. DMA mode is still enabled only after channel
acquisition and RX buffer allocation succeed.

The issue was found by our static-analysis tool and manually reviewed.

Fixes: 3c6a483275f4 ("Serial: EG20T: add PCH_UART driver")
Signed-off-by: Pengpeng Hou <hppiscas@xxxxxxx>
---
The original patch was prepared with Gemini. Codex assisted with this
review and revision (Assisted-by: gpt 5).
Built pch_uart.o on x86-64 with GCC 11.4 and W=1
(CONFIG_SERIAL_PCH_UART=m, CONFIG_PCH_DMA=m). No runtime or hardware
test was performed.

drivers/tty/serial/pch_uart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 9505d255f09c522ce30d95021f549907eb025284..b37d4bfc60f6f47ae571c23a02f48879e3742083 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1418,7 +1418,7 @@ static int pch_uart_verify_port(struct uart_port *port,
priv->use_dma = 0;
serinfo->flags &= ~UPF_LOW_LATENCY;
} else {
-#ifndef CONFIG_PCH_DMA
+#if !IS_ENABLED(CONFIG_PCH_DMA)
dev_err(priv->port.dev, "%s : PCH DMA is not Loaded.\n",
__func__);
return -EOPNOTSUPP;

base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106