提交 d70a7b16 编写于 作者: P Peter Hurley 提交者: Greg Kroah-Hartman

serial: 8250: Unlink uart console ptr if console setup fails

If console setup fails (eg., there is no valid port at that index),
unlink the console ptr; otherwise, when the driver unloads, the
console will be unregistered (even though setup, and thus registration,
failed) and a console disabled message will be printed.
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 6a597a38
...@@ -597,6 +597,7 @@ static void univ8250_console_write(struct console *co, const char *s, ...@@ -597,6 +597,7 @@ static void univ8250_console_write(struct console *co, const char *s,
static int univ8250_console_setup(struct console *co, char *options) static int univ8250_console_setup(struct console *co, char *options)
{ {
struct uart_port *port; struct uart_port *port;
int retval;
/* /*
* Check whether an invalid uart number has been specified, and * Check whether an invalid uart number has been specified, and
...@@ -609,7 +610,10 @@ static int univ8250_console_setup(struct console *co, char *options) ...@@ -609,7 +610,10 @@ static int univ8250_console_setup(struct console *co, char *options)
/* link port to console */ /* link port to console */
port->cons = co; port->cons = co;
return serial8250_console_setup(port, options, false); retval = serial8250_console_setup(port, options, false);
if (retval != 0)
port->cons = NULL;
return retval;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册