lkml.org 
[lkml]   [2020]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/1] tty: serial: owl: Initialize lock before registering port
On Fri, May 29, 2020 at 2:56 PM Andreas Färber <afaerber@suse.de> wrote:
>
> Am 29.05.20 um 13:34 schrieb Greg Kroah-Hartman:
> > On Fri, May 29, 2020 at 02:06:47PM +0300, Cristian Ciocaltea wrote:
> >> Running a lockdep-enabled kernel leads to the following splat when
> >> probing the owl-uart driver:

...

> >> Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
> >> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>

> >> + spin_lock_init(&owl_port->port.lock);
> >> +
> >> ret = uart_add_one_port(&owl_uart_driver, &owl_port->port);
> >> if (ret)
> >> owl_uart_ports[pdev->id] = NULL;
> >
> > Ugh, another one :(
> >
> > Thanks for this, will queue this up now.
>
> Thanks. If this is the expected pattern now, I'll also have to update
> in-flight patches, such as Sunplus.

Expected is to register properly console via register_console() call.
If you do so, you also need to initialize spin lock before coming to
uart_add_one_port().
It seems drivers (ab)used that feature.

$ git grep -n -w register_console -- drivers/tty/serial/ | cut -f1 -d:
| sort -u | wc -l
37
$ git grep -n _CONSOLE -- drivers/tty/serial/ | cut -f1 -d: | sort -u | wc -l
77

But as a quick fix this initialization is okay.

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2020-05-29 14:05    [W:0.100 / U:0.932 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site