If the serial port being removed is used as a console, it must also be
unregistered from the console subsystem using unregister_console().
uart_ops.release_port() will release resources (e.g. iounmap() the serial
port registers), causing a crash on subsequent kernel output if the console
is still registered.
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
if (port->tty)
tty_vhangup(port->tty);
+ /*
+ * If the port is used as a console, unregister it
+ */
+ if (uart_console(uport))
+ unregister_console(uport->cons);
+
/*
* Free the port IO and memory resources, if any.
*/