diff mbox

serial: sh-sci: prevent setup of uninitialized serial console

Message ID 1297221526-32283-1-git-send-email-gnurou@gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Alexandre Courbot Feb. 9, 2011, 3:18 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 0257fd5..e180bc9 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1830,6 +1830,12 @@  static int __devinit serial_console_setup(struct console *co, char *options)
 	sci_port = &sci_ports[co->index];
 	port = &sci_port->port;
 
+	/*
+	 * Refuse to handle uninitialized ports.
+	 */
+	if (!port->ops)
+		return -ENODEV;
+
 	ret = sci_remap_port(port);
 	if (unlikely(ret != 0))
 		return ret;