Skip to contentSkip to conversation

tty: serial: Work around warning backtrace in serial8250_set_defaults

PATCH In review Guenter Roeck 3 participants 4 messages Dec 5, 2024 – Dec 6, 2024 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
Cc Niklas Schnelle <[email protected]>

---
A complete fix will require a sequence of patches, which will have to be tested thoroughly and is thus not 6.13 material. This patch doesn't fix the underlying problem, but it is good enough for 6.13, or at least not worse than 6.12, while at the same time avoiding the warning backtrace.

 drivers/tty/serial/8250/8250_port.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +2 -1
index 4d63d80e78a9..649e74e9b52f 100644
@@ -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;
 	}
Signature · 1 line
2.45.2
Tested-by on v1 1/1
#1 lore raw
Quoted 18 lines · Guenter Roeck

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")
Cc Niklas Schnelle <[email protected]>
Quoted 5 lines

---
A complete fix will require a sequence of patches, which will have to be tested thoroughly and is thus not 6.13 material. This patch doesn't fix the underlying problem, but it is good enough for 6.13, or at least not worse than 6.12, while at the same time avoiding the warning backtrace.

This works on OpenRISC where I was seeing the issue. Has someone comitted to work on the root cause?

Quoted 21 lines
 drivers/tty/serial/8250/8250_port.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +2 -1
index 4d63d80e78a9..649e74e9b52f 100644
@@ -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;
 	}
Signature · 1 line
2.45.2
#2 lore raw
Quoted 25 lines · Stafford Horne
Quoted 18 lines · Guenter Roeck

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")
Cc Niklas Schnelle <[email protected]>
Quoted 5 lines

---
A complete fix will require a sequence of patches, which will have to be tested thoroughly and is thus not 6.13 material. This patch doesn't fix the underlying problem, but it is good enough for 6.13, or at least not worse than 6.12, while at the same time avoiding the warning backtrace.

Quoted 3 lines

This works on OpenRISC where I was seeing the issue. Has someone comitted to work on the root cause?

Yes, Arnd is working on it.

Guenter

Quoted 23 lines
Quoted 21 lines
 drivers/tty/serial/8250/8250_port.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_port.c +2 -1
index 4d63d80e78a9..649e74e9b52f 100644
@@ -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;
 	}
Signature · 1 line
2.45.2
#3 lore raw
In reply to Guenter Roeck
Quoted 18 lines · Guenter Roeck

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")
Cc Niklas Schnelle <[email protected]>
Quoted 5 lines

---
A complete fix will require a sequence of patches, which will have to be tested thoroughly and is thus not 6.13 material. This patch doesn't fix the underlying problem, but it is good enough for 6.13, or at least not worse than 6.12, while at the same time avoiding the warning backtrace.

Thanks, I'll take this for now.

greg k-h