* [PATCH] tty: serial: Work around warning backtrace in serial8250_set_defaults
@ 2024-12-05 14:30 Guenter Roeck
2024-12-05 19:12 ` Stafford Horne
2024-12-06 6:58 ` Greg Kroah-Hartman
0 siblings, 2 replies; 4+ messages in thread
From: Guenter Roeck @ 2024-12-05 14:30 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jiri Slaby, linux-kernel, linux-serial, Guenter Roeck,
Arnd Bergmann, Niklas Schnelle
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>
---
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(-)
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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] tty: serial: Work around warning backtrace in serial8250_set_defaults
2024-12-05 14:30 [PATCH] tty: serial: Work around warning backtrace in serial8250_set_defaults Guenter Roeck
@ 2024-12-05 19:12 ` Stafford Horne
2024-12-05 19:29 ` Guenter Roeck
2024-12-06 6:58 ` Greg Kroah-Hartman
1 sibling, 1 reply; 4+ messages in thread
From: Stafford Horne @ 2024-12-05 19:12 UTC (permalink / raw)
To: Guenter Roeck
Cc: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial,
Arnd Bergmann, Niklas Schnelle
On Thu, Dec 05, 2024 at 06:30:33AM -0800, Guenter Roeck wrote:
> 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>
> ---
> 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?
Tested-by: Stafford Horne <shorne@gmail.com>
> 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
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] tty: serial: Work around warning backtrace in serial8250_set_defaults
2024-12-05 19:12 ` Stafford Horne
@ 2024-12-05 19:29 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2024-12-05 19:29 UTC (permalink / raw)
To: Stafford Horne
Cc: Greg Kroah-Hartman, Jiri Slaby, linux-kernel, linux-serial,
Arnd Bergmann, Niklas Schnelle
On Thu, Dec 05, 2024 at 07:12:42PM +0000, Stafford Horne wrote:
> On Thu, Dec 05, 2024 at 06:30:33AM -0800, Guenter Roeck wrote:
> > 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>
> > ---
> > 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?
>
Yes, Arnd is working on it.
Guenter
> Tested-by: Stafford Horne <shorne@gmail.com>
>
> > 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
> >
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] tty: serial: Work around warning backtrace in serial8250_set_defaults
2024-12-05 14:30 [PATCH] tty: serial: Work around warning backtrace in serial8250_set_defaults Guenter Roeck
2024-12-05 19:12 ` Stafford Horne
@ 2024-12-06 6:58 ` Greg Kroah-Hartman
1 sibling, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2024-12-06 6:58 UTC (permalink / raw)
To: Guenter Roeck
Cc: Jiri Slaby, linux-kernel, linux-serial, Arnd Bergmann,
Niklas Schnelle
On Thu, Dec 05, 2024 at 06:30:33AM -0800, Guenter Roeck wrote:
> 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>
> ---
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-12-06 6:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-05 14:30 [PATCH] tty: serial: Work around warning backtrace in serial8250_set_defaults Guenter Roeck
2024-12-05 19:12 ` Stafford Horne
2024-12-05 19:29 ` Guenter Roeck
2024-12-06 6:58 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox