From: "j.turek" <jakub.turek@elsta.tech>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org
Cc: michal.simek@amd.com, namcao@linutronix.de, tglx@linutronix.de,
zack.rusin@broadcom.com, sean.anderson@linux.dev,
hshah@axiado.com, linux-serial@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, "j.turek" <jakub.turek@elsta.tech>
Subject: [PATCH] serial: xilinx_uartps: fix rs485 initialization at boot
Date: Tue, 16 Dec 2025 16:26:41 +0100 [thread overview]
Message-ID: <20251216152641.196221-1-jakub.turek@elsta.tech> (raw)
When 'linux,rs485-enabled-at-boot-time;' property is enabled in device-tree
and there is no rts-gpio defined there is NULL pointer dereference in
function 'cdns_rts_gpio_enable' because 'cdns_uart->port->membase' pointer
is not set at this point
Signed-off-by: Jakub Turek <jakub.turek@elsta.tech>
Fixes: fccc9d9233f9 ("tty: serial: uartps: Add rs485 support to uartps driver")
---
drivers/tty/serial/xilinx_uartps.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c
index c793fc74c26b..1e4d54fd5762 100644
--- a/drivers/tty/serial/xilinx_uartps.c
+++ b/drivers/tty/serial/xilinx_uartps.c
@@ -1816,8 +1816,6 @@ static int cdns_uart_probe(struct platform_device *pdev)
console_port = port;
}
#endif
- if (cdns_uart_data->port->rs485.flags & SER_RS485_ENABLED)
- cdns_rs485_rx_setup(cdns_uart_data);
rc = uart_add_one_port(&cdns_uart_uart_driver, port);
if (rc) {
@@ -1826,6 +1824,9 @@ static int cdns_uart_probe(struct platform_device *pdev)
goto err_out_pm_disable;
}
+ if (cdns_uart_data->port->rs485.flags & SER_RS485_ENABLED)
+ cdns_rs485_rx_setup(cdns_uart_data);
+
#ifdef CONFIG_SERIAL_XILINX_PS_UART_CONSOLE
/* This is not port which is used for console that's why clean it up */
if (console_port == port &&
--
2.34.1
next reply other threads:[~2025-12-16 15:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 15:26 j.turek [this message]
2025-12-16 15:44 ` Sean Anderson
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=20251216152641.196221-1-jakub.turek@elsta.tech \
--to=jakub.turek@elsta.tech \
--cc=gregkh@linuxfoundation.org \
--cc=hshah@axiado.com \
--cc=jirislaby@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=namcao@linutronix.de \
--cc=sean.anderson@linux.dev \
--cc=tglx@linutronix.de \
--cc=zack.rusin@broadcom.com \
/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®