From: Andy Shevchenko <[email protected]>

commit 8f065acec7573672dd15916e31d1e9b2e785566c upstream.

The commit a3cb39d258ef
("serial: core: Allow detach and attach serial device for console")
changed a bit logic behind lock initialization since for most of the console
driver it's supposed to have lock already initialized even if console is not
enabled. However, it's not the case for Freescale IMX console.

Initialize lock explicitly in the ->probe().

Note, there is still an open question should or shouldn't not this driver
register console properly.

Fixes: a3cb39d258ef ("serial: core: Allow detach and attach serial device for 
console")
Reported-by: Guenter Roeck <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Link: 
https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/tty/serial/imx.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2398,6 +2398,9 @@ static int imx_uart_probe(struct platfor
                }
        }
 
+       /* We need to initialize lock even for non-registered console */
+       spin_lock_init(&sport->port.lock);
+
        imx_uart_ports[sport->port.line] = sport;
 
        platform_set_drvdata(pdev, sport);


Reply via email to