video: s3c-fb: fix possible division by zero in s3c_fb_calc_pixclk
authorJingoo Han <jg1.han@samsung.com>
Mon, 11 Jun 2012 02:27:27 +0000 (11:27 +0900)
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Wed, 13 Jun 2012 17:34:16 +0000 (17:34 +0000)
Divider value can be zero and it makes division by zero
from debug message in s3c_fb_calc_pixclk; therefore, it
should be fixed.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
drivers/video/s3c-fb.c

index b5c29399a5ee3fc83e14200e4442dab54c6a6970..ea7b661e7229039c29770c50414f4846e6865192 100644 (file)
@@ -361,7 +361,7 @@ static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk)
        result = (unsigned int)tmp / 1000;
 
        dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n",
-               pixclk, clk, result, clk / result);
+               pixclk, clk, result, result ? clk / result : clk);
 
        return result;
 }