Thread (11 messages) 11 messages, 5 authors, 2020-07-11

Re: [PATCH 1/1] tty: serial: owl: Initialize lock before registering port

From: Andy Shevchenko <hidden>
Date: 2020-05-29 12:04:03
Also in: linux-serial, lkml

On Fri, May 29, 2020 at 2:56 PM Andreas Färber [off-list ref] wrote:
Am 29.05.20 um 13:34 schrieb Greg Kroah-Hartman:
quoted
On Fri, May 29, 2020 at 02:06:47PM +0300, Cristian Ciocaltea wrote:
quoted
Running a lockdep-enabled kernel leads to the following splat when
probing the owl-uart driver:
...
quoted
quoted
Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for console")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@gmail.com>
quoted
quoted
+    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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help