linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented
@ 2015-12-02 13:20 Dongsheng Wang
  2015-12-03  1:12 ` Timur Tabi
  0 siblings, 1 reply; 2+ messages in thread
From: Dongsheng Wang @ 2015-12-02 13:20 UTC (permalink / raw)
  To: linux-fbdev

From: Wang Dongsheng <dongsheng.wang@freescale.com>

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>
---
v2:
- Move set_pixel_clock judgement to fsl_diu_init.

diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index b335c1a..7052200 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,10 @@ static int __init fsl_diu_init(void)
 #else
 	monitor_port = fsl_diu_name_to_port(monitor_string);
 #endif
+
+	if (!diu_ops.set_pixel_clock)
+		return -ENODEV;
+
 	pr_info("Freescale Display Interface Unit (DIU) framebuffer driver\n");
 
 #ifdef CONFIG_NOT_COHERENT_CACHE
-- 
2.1.0.27.g96db324


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented
  2015-12-02 13:20 [PATCH v2] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented Dongsheng Wang
@ 2015-12-03  1:12 ` Timur Tabi
  0 siblings, 0 replies; 2+ messages in thread
From: Timur Tabi @ 2015-12-03  1:12 UTC (permalink / raw)
  To: linux-fbdev

Dongsheng Wang wrote:
> From: Wang Dongsheng <dongsheng.wang@freescale.com>
>
> If diu_ops is not implemented on platform, kernel will access a null
> pointer. we need to check this pointer in diu initialization.

Please fix capitalization: We, DIU, NULL.

> @@ -1915,6 +1918,10 @@ static int __init fsl_diu_init(void)
>   #else
>   	monitor_port = fsl_diu_name_to_port(monitor_string);
>   #endif
> +
> +	if (!diu_ops.set_pixel_clock)
> +		return -ENODEV;
> +

Please add a comment explaining that set_pixel_clock is required, so if 
it isn't set, then that means that there is no platform support for the DIU.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-03  1:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-02 13:20 [PATCH v2] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented Dongsheng Wang
2015-12-03  1:12 ` Timur Tabi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).