]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/tty_io.c
drivers/char/tty_io.c: Avoid panic when no console is configured.
[linux-2.6-omap-h63xx.git] / drivers / char / tty_io.c
index 59f472143f087d9486d62bd9f3842c2a9aee7eb6..1412a8d1e58de75059b5687b533e77e4667f44a3 100644 (file)
@@ -1795,12 +1795,15 @@ retry_open:
        }
 #endif
        if (device == MKDEV(TTYAUX_MAJOR, 1)) {
-               driver = tty_driver_kref_get(console_device(&index));
-               if (driver) {
-                       /* Don't let /dev/console block */
-                       filp->f_flags |= O_NONBLOCK;
-                       noctty = 1;
-                       goto got_driver;
+               struct tty_driver *console_driver = console_device(&index);
+               if (console_driver) {
+                       driver = tty_driver_kref_get(console_driver);
+                       if (driver) {
+                               /* Don't let /dev/console block */
+                               filp->f_flags |= O_NONBLOCK;
+                               noctty = 1;
+                               goto got_driver;
+                       }
                }
                mutex_unlock(&tty_mutex);
                return -ENODEV;