[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4446d7dc-efb0-4395-8fcb-7177d9e07b5c@roeck-us.net>
Date: Wed, 4 Dec 2024 13:09:31 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Niklas Schnelle <schnelle@...ux.ibm.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
linux-serial@...r.kernel.org, Heiko Carstens <hca@...ux.ibm.com>,
linux-kernel@...r.kernel.org,
Yang Yingliang <yangyingliang@...wei.com>
Subject: Re: [PATCH 1/1] tty: serial: handle HAS_IOPORT dependencies
On Mon, Nov 25, 2024 at 04:59:00PM +0100, Arnd Bergmann wrote:
> On Mon, Nov 25, 2024, at 12:06, Arnd Bergmann wrote:
> > +unsigned int nr_uarts = ARRAY_SIZE(old_serial_port);;
> > +
>
> Unfortunately, this breaks on non-x86 because of the check
> added in 59cfc45f17d6 ("serial: 8250: Do nothing if nr_uarts=0").
>
> I still think it's the right idea, but need to unwind further
> to make this possible, and find a different fix for the bug
> from that commit.
>
I decided to apply the patch below to my fixes branch. It doesn't change
the code, it just gets rid of the warning backtrace.
Guenter
---
>From 96c4d1ab237f4a418d17a66c114493273b87468a Mon Sep 17 00:00:00 2001
From: Guenter Roeck <linux@...ck-us.net>
Date: Wed, 4 Dec 2024 10:58:41 -0800
Subject: [PATCH] tty: serial: Work around warning backtrace in
serial8250_set_defaults
Commit 7c7e6c8924e7 ("tty: serial: handle HAS_IOPORT dependencies")
triggers warning backtraces on a number of platforms which don't support
IO ports.
WARNING: CPU: 0 PID: 0 at drivers/tty/serial/8250/8250_port.c:470 serial8250_set_defaults+0x148/0x1d8
Unsupported UART type 0
The problem is seen because serial8250_set_defaults() is called for
all members of the serial8250_ports[] array even if that array is
not initialized.
Work around the problem by only displaying the warning if the port
type is not 0 (UPIO_PORT) or if iobase is set for the port.
Fixes: 7c7e6c8924e7 ("tty: serial: handle HAS_IOPORT dependencies")
Signed-off-by: Guenter Roeck <linux@...ck-us.net>
---
drivers/tty/serial/8250/8250_port.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 4d63d80e78a9..649e74e9b52f 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -467,7 +467,8 @@ static void set_io_from_upio(struct uart_port *p)
break;
#endif
default:
- WARN(1, "Unsupported UART type %x\n", p->iotype);
+ WARN(p->iotype != UPIO_PORT || p->iobase,
+ "Unsupported UART type %x\n", p->iotype);
p->serial_in = no_serial_in;
p->serial_out = no_serial_out;
}
--
2.45.2
Powered by blists - more mailing lists