Skip to content

Commit 4e450df

Browse files
groeckgregkh
authored andcommitted
tty: serial: Work around warning backtrace in serial8250_set_defaults
Commit 7c7e6c8 ("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: 7c7e6c8 ("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>
1 parent 7cc0e0a commit 4e450df

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/tty/serial/8250/8250_port.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,8 @@ static void set_io_from_upio(struct uart_port *p)
467467
break;
468468
#endif
469469
default:
470-
WARN(1, "Unsupported UART type %x\n", p->iotype);
470+
WARN(p->iotype != UPIO_PORT || p->iobase,
471+
"Unsupported UART type %x\n", p->iotype);
471472
p->serial_in = no_serial_in;
472473
p->serial_out = no_serial_out;
473474
}

0 commit comments

Comments
 (0)