Skip to content

Commit

Permalink
serial: imx: Initialize lock for non-registered console
Browse files Browse the repository at this point in the history
The commit a3cb39d
("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: a3cb39d ("serial: core: Allow detach and attach serial device for console")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200525105952.13744-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Andy Shevchenko authored and Greg Kroah-Hartman committed May 27, 2020
1 parent 344235f commit 8f065ac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/tty/serial/imx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8f065ac

Please sign in to comment.