drm: avoid switching to text console if there is no panic timeout
[GitHub/LineageOS/android_kernel_samsung_universal7580.git] / drivers / gpu / drm / drm_fb_helper.c
index 80fe39d98b0c2e2ca7a22b762d3d9dcf87781d1c..aada26f63decc7a91d2803079dc9795d053ecdc2 100644 (file)
@@ -255,6 +255,13 @@ bool drm_fb_helper_force_kernel_mode(void)
 int drm_fb_helper_panic(struct notifier_block *n, unsigned long ununsed,
                        void *panic_str)
 {
+       /*
+        * It's a waste of time and effort to switch back to text console
+        * if the kernel should reboot before panic messages can be seen.
+        */
+       if (panic_timeout < 0)
+               return 0;
+
        printk(KERN_ERR "panic occurred, switching back to text console\n");
        return drm_fb_helper_force_kernel_mode();
 }