Skip to content

Commit

Permalink
video: fbdev: fsl: Fix kernel crash when diu_ops is not implemented
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Wang Dongsheng authored and Tomi Valkeinen committed Dec 9, 2015
1 parent 527e931 commit acfc1cc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/video/fbdev/fsl-diu-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit acfc1cc

Please sign in to comment.