]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
fbdev: sh-mobile-lcdc: fix potential Oops in SH-Mobile LCDC framebuffer driver
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Wed, 30 Jun 2010 09:26:35 +0000 (09:26 +0000)
committerPaul Mundt <lethal@linux-sh.org>
Wed, 4 Aug 2010 07:03:02 +0000 (16:03 +0900)
sh_mobile_lcdc_setup_clocks() can perform IO, therefore it has to be called
after ioremap(). Also check return code of ioremap() and use resource_size()
instead of open-coding it.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
drivers/video/sh_mobile_lcdcfb.c

index 12c451a711e935d767d74677923b1202f0ed629f..0c97509d0237fd3eb9a6bcbfc5098bf2ac1b91af 100644 (file)
@@ -1020,14 +1020,16 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
                goto err1;
        }
 
+       priv->base = ioremap_nocache(res->start, resource_size(res));
+       if (!priv->base)
+               goto err1;
+
        error = sh_mobile_lcdc_setup_clocks(pdev, pdata->clock_source, priv);
        if (error) {
                dev_err(&pdev->dev, "unable to setup clocks\n");
                goto err1;
        }
 
-       priv->base = ioremap_nocache(res->start, (res->end - res->start) + 1);
-
        for (i = 0; i < j; i++) {
                cfg = &priv->ch[i].cfg;