]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tty: serial: Work around warning backtrace in serial8250_set_defaults
authorGuenter Roeck <linux@roeck-us.net>
Thu, 5 Dec 2024 14:30:33 +0000 (06:30 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Dec 2024 07:00:01 +0000 (08:00 +0100)
commit4e450dfd0f968b79204637bf13280892dff287b1
tree882a74394fd1cf32cc9b27c47092a6717404cd57
parent7cc0e0a43a91052477c2921f924a37d9c3891f0c
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")
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Stafford Horne <shorne@gmail.com>
Link: https://lore.kernel.org/r/20241205143033.2695333-1-linux@roeck-us.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_port.c