summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorWang Dongsheng <dongsheng.wang@freescale.com>2015-12-03 09:54:12 +0800
committerTomi Valkeinen <tomi.valkeinen@ti.com>2015-12-09 12:57:06 +0200
commitacfc1cc13fe5bc6d7a10afa624f1e560850ddad3 (patch)
treefa36f51432baaa22020a1d8d0da4ea034db9d817 /drivers/video
parent527e9316f8ec44bd53d90fb9f611fa7ffff52bb9 (diff)
video: fbdev: fsl: Fix kernel crash when diu_ops is not implemented
If diu_ops is not implemented on platform, kernel will access a NULL pointer. We need to check this pointer in DIU initialization. Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com> Acked-by: Timur Tabi <timur@tabi.org> Cc: stable@vger.kernel.org Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/fbdev/fsl-diu-fb.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index b335c1ae8625..fe00a07c122e 100644
--- a/drivers/video/fbdev/fsl-diu-fb.c
+++ b/drivers/video/fbdev/fsl-diu-fb.c
@@ -479,7 +479,10 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s)
port = FSL_DIU_PORT_DLVDS;
}
- return diu_ops.valid_monitor_port(port);
+ if (diu_ops.valid_monitor_port)
+ port = diu_ops.valid_monitor_port(port);
+
+ return port;
}
/*
@@ -1915,6 +1918,14 @@ static int __init fsl_diu_init(void)
#else
monitor_port = fsl_diu_name_to_port(monitor_string);
#endif
+
+ /*
+ * Must to verify set_pixel_clock. If not implement on platform,
+ * then that means that there is no platform support for the DIU.
+ */
+ if (!diu_ops.set_pixel_clock)
+ return -ENODEV;
+
pr_info("Freescale Display Interface Unit (DIU) framebuffer driver\n");
#ifdef CONFIG_NOT_COHERENT_CACHE