diff mbox

fbdev: sh-mobile-lcdc: fix potential Oops in SH-Mobile LCDC framebuffer driver

Message ID Pine.LNX.4.64.1006301120560.17489@axis700.grange (mailing list archive)
State Accepted
Commit dba6f385b83d7f19eb1d4df12f422bab945c7f10
Headers show

Commit Message

Guennadi Liakhovetski June 30, 2010, 9:26 a.m. UTC
None
diff mbox

Patch

diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index e8c7699..1ece226 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -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;