Commit d28122a5 authored by Russell King's avatar Russell King Committed by Russell King

[ARM] Fix AMBA serial drivers for non-first serial ports

Using console=ttyAM1 or console=ttyAMA1 resulted in an oops during
boot due to trying to drive the console before that port had been
registered.  Fix this by checking whether the port is present before
allowing console setup to proceed.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 7f215abc
...@@ -589,6 +589,8 @@ static int __init pl010_console_setup(struct console *co, char *options) ...@@ -589,6 +589,8 @@ static int __init pl010_console_setup(struct console *co, char *options)
*/ */
if (co->index >= UART_NR) if (co->index >= UART_NR)
co->index = 0; co->index = 0;
if (!amba_ports[co->index])
return -ENODEV;
port = &amba_ports[co->index]->port; port = &amba_ports[co->index]->port;
if (options) if (options)
......
...@@ -661,6 +661,8 @@ static int __init pl011_console_setup(struct console *co, char *options) ...@@ -661,6 +661,8 @@ static int __init pl011_console_setup(struct console *co, char *options)
if (co->index >= UART_NR) if (co->index >= UART_NR)
co->index = 0; co->index = 0;
uap = amba_ports[co->index]; uap = amba_ports[co->index];
if (!uap)
return -ENODEV;
uap->port.uartclk = clk_get_rate(uap->clk); uap->port.uartclk = clk_get_rate(uap->clk);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment