OSDN Git Service

fix - ensure we don't use bootconsoles after init has been released
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / kernel / printk.c
index 5c7c325..8451dfc 100644 (file)
@@ -1085,10 +1085,12 @@ EXPORT_SYMBOL(unregister_console);
 
 static int __init disable_boot_consoles(void)
 {
-       if (console_drivers->flags & CON_BOOT) {
-               printk(KERN_INFO "turn off boot console %s%d\n",
-                       console_drivers->name, console_drivers->index);
-               return unregister_console(console_drivers);
+       if (console_drivers != NULL) {
+               if (console_drivers->flags & CON_BOOT) {
+                       printk(KERN_INFO "turn off boot console %s%d\n",
+                               console_drivers->name, console_drivers->index);
+                       return unregister_console(console_drivers);
+               }
        }
        return 0;
 }