From: Andy Shevchenko Date: Mon, 25 May 2020 10:59:52 +0000 (+0300) Subject: serial: imx: Initialize lock for non-registered console X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8f065acec7573672dd15916e31d1e9b2e785566c;p=linux.git serial: imx: Initialize lock for non-registered console 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 Cc: stable Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20200525105952.13744-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 986d902fb7fe5..6b078e395931f 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -2404,6 +2404,9 @@ static int imx_uart_probe(struct platform_device *pdev) } } + /* 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);