lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230928221246.13689-7-LinoSanfilippo@gmx.de>
Date:   Fri, 29 Sep 2023 00:12:46 +0200
From:   Lino Sanfilippo <LinoSanfilippo@....de>
To:     gregkh@...uxfoundation.org, jirislaby@...nel.org
Cc:     shawnguo@...nel.org, s.hauer@...gutronix.de,
        ilpo.jarvinen@...ux.intel.com, mcoquelin.stm32@...il.com,
        alexandre.torgue@...s.st.com, linux-kernel@...r.kernel.org,
        linux-serial@...r.kernel.org, l.sanfilippo@...bus.com,
        LinoSanfilippo@....de, lukas@...ner.de, p.rosenberger@...bus.com
Subject: [PATCH 6/6] serial: imx: do not set RS485 enabled if it is not supported

From: Lino Sanfilippo <l.sanfilippo@...bus.com>

If the imx driver cannot support RS485 it sets the UARTS rs485_supported
structure to NULL. But it still calls uart_get_rs485_mode() which may set
the RS485_ENABLED flag.
The flag however is evaluated by the serial core in uart_configure_port()
at port startup and thus may lead to an attempt to configure RS485 even if
it is not supported.

Avoid this by calling uart_get_rs485_mode() only if RS485 is actually
supported by the driver. Remove also a check for an error condition
that is not possible any more now.

Signed-off-by: Lino Sanfilippo <l.sanfilippo@...bus.com>
---
 drivers/tty/serial/imx.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index edb2ec6a5567..87689abc21bd 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2326,16 +2326,14 @@ static int imx_uart_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = uart_get_rs485_mode(&sport->port);
-	if (ret) {
-		clk_disable_unprepare(sport->clk_ipg);
-		return ret;
+	if (sport->port.rs485_supported.flags & SER_RS485_ENABLED) {
+		ret = uart_get_rs485_mode(&sport->port);
+		if (ret) {
+			clk_disable_unprepare(sport->clk_ipg);
+			return ret;
+		}
 	}
 
-	if (sport->port.rs485.flags & SER_RS485_ENABLED &&
-	    (!sport->have_rtscts && !sport->have_rtsgpio))
-		dev_err(&pdev->dev, "no RTS control, disabling rs485\n");
-
 	/*
 	 * If using the i.MX UART RTS/CTS control then the RTS (CTS_B)
 	 * signal cannot be set low during transmission in case the
-- 
2.40.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ