video: tegra: fix crash when no HDMI modes are supported
authorErik Gilling <konkers@android.com>
Fri, 5 Nov 2010 22:30:35 +0000 (15:30 -0700)
committerErik Gilling <konkers@android.com>
Tue, 9 Nov 2010 21:54:36 +0000 (13:54 -0800)
Change-Id: I2e23d018d5acb814e7a088921c26c8f305790442
Signed-off-by: Erik Gilling <konkers@android.com>
drivers/video/tegra/fb.c

index a4f38c4f15f0159be2a75f4cbb76b5b7b357395f..6992e1c06ddfff6b398a923893f5751075ea1078 100644 (file)
@@ -604,15 +604,21 @@ void tegra_fb_update_monspecs(struct tegra_fb_info *fb_info,
                }
        }
 
-       /* in case the first mode was not matched */
-       m = list_first_entry(&fb_info->info->modelist, struct fb_modelist, list);
-       m->mode.flag |= FB_MODE_IS_FIRST;
-
-       fb_info->info->mode = (struct fb_videomode *)
-               fb_find_best_display(specs, &fb_info->info->modelist);
-
-       fb_videomode_to_var(&fb_info->info->var, fb_info->info->mode);
-       tegra_fb_set_par(fb_info->info);
+       if (list_empty(&fb_info->info->modelist)) {
+               struct tegra_dc_mode mode;
+               memset(&fb_info->info->var, 0x0, sizeof(fb_info->info->var));
+               memset(&mode, 0x0, sizeof(mode));
+               tegra_dc_set_mode(fb_info->win->dc, &mode);
+       } else {
+               /* in case the first mode was not matched */
+               m = list_first_entry(&fb_info->info->modelist, struct fb_modelist, list);
+               m->mode.flag |= FB_MODE_IS_FIRST;
+               fb_info->info->mode = (struct fb_videomode *)
+                       fb_find_best_display(specs, &fb_info->info->modelist);
+
+               fb_videomode_to_var(&fb_info->info->var, fb_info->info->mode);
+               tegra_fb_set_par(fb_info->info);
+       }
 
        event.info = fb_info->info;
        fb_notifier_call_chain(FB_EVENT_NEW_MODELIST, &event);