From cd12d03fbddf824fb75499fbf20dbd545226c95c Mon Sep 17 00:00:00 2001 From: Matt Sealey Date: Mon, 1 Nov 2010 14:04:37 -0500 Subject: [PATCH] Catch pixclk div0 If pixclk is 0, we would get a div0 since it is used in an unchecked division via a macro. If the pixel clock is 0, just skip the mode for now, reporting it as a bug. Thanks to Saleem Abdulrasool --- arch/arm/mach-mx5/mx51_efikamx_display.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/arch/arm/mach-mx5/mx51_efikamx_display.c b/arch/arm/mach-mx5/mx51_efikamx_display.c index f8867f7b152..88b7519e07b 100644 --- a/arch/arm/mach-mx5/mx51_efikamx_display.c +++ b/arch/arm/mach-mx5/mx51_efikamx_display.c @@ -209,6 +209,12 @@ void mxcfb_dump_modeline( struct fb_videomode *modedb, int num) mode = &modedb[i]; + BUG_ON(mode->pixclock == 0); + if (mode->pixclock == 0) { + printk(KERN_ERR "skipping mode entry %u due to bad pclk", i); + continue; + } + printk(" \"%dx%d%s%d\" %lu.%02lu ", mode->xres, mode->yres, (mode->vmode & FB_VMODE_INTERLACED) ? "i@" : "@", mode->refresh, (PICOS2KHZ(mode->pixclock) * 1000UL)/1000000, @@ -332,6 +338,12 @@ void mxcfb_sanitize_modelist(const struct fb_info *info, const struct fb_videomo list_for_each_safe(pos, n, head) { modelist = list_entry(pos, struct fb_modelist, list); + BUG_ON(modelist->mode.pixclock == 0); + if (modelist->mode.pixclock == 0) { + printk(KERN_ERR "skipping mode %ux%u due to bad pclk", + modelist->mode.xres, modelist->mode.yres); + continue; + } if (PICOS2KHZ(modelist->mode.pixclock) > 133000 ) { printk(KERN_INFO "%ux%u%s%u pclk=%u removed (pixclk higher than %lu limit)\n", modelist->mode.xres, modelist->mode.yres,