Commit be55f7df authored by Wang Dongsheng's avatar Wang Dongsheng Committed by Luis Henriques

video: fbdev: fsl: Fix kernel crash when diu_ops is not implemented

commit acfc1cc1 upstream.

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: default avatarWang Dongsheng <dongsheng.wang@freescale.com>
Acked-by: default avatarTimur Tabi <timur@tabi.org>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent dff790f9
...@@ -479,7 +479,10 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s) ...@@ -479,7 +479,10 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s)
port = FSL_DIU_PORT_DLVDS; 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;
} }
/* /*
...@@ -1909,6 +1912,14 @@ static int __init fsl_diu_init(void) ...@@ -1909,6 +1912,14 @@ static int __init fsl_diu_init(void)
#else #else
monitor_port = fsl_diu_name_to_port(monitor_string); monitor_port = fsl_diu_name_to_port(monitor_string);
#endif #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"); pr_info("Freescale Display Interface Unit (DIU) framebuffer driver\n");
#ifdef CONFIG_NOT_COHERENT_CACHE #ifdef CONFIG_NOT_COHERENT_CACHE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment