linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented
@ 2015-11-24  6:27 Dongsheng Wang
  2015-11-24 10:46 ` Tomi Valkeinen
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: Dongsheng Wang @ 2015-11-24  6:27 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>

diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c
index b335c1a..288b5e4 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;
 }
 
 /*
@@ -1697,6 +1700,9 @@ static int fsl_diu_probe(struct platform_device *pdev)
 	unsigned int i;
 	int ret;
 
+	if (!diu_ops.set_pixel_clock)
+		return -ENODEV;
+
 	data = dmam_alloc_coherent(&pdev->dev, sizeof(struct fsl_diu_data),
 				   &dma_addr, GFP_DMA | __GFP_ZERO);
 	if (!data)
-- 
2.1.0.27.g96db324


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

end of thread, other threads:[~2015-12-01 14:53 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-24  6:27 [PATCH] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented Dongsheng Wang
2015-11-24 10:46 ` Tomi Valkeinen
2015-11-24 11:01 ` Wang Dongsheng
2015-11-24 16:04 ` Timur Tabi
2015-11-24 16:12 ` Timur Tabi
2015-11-24 16:15 ` Scott Wood
2015-11-24 16:15 ` Tomi Valkeinen
2015-11-24 16:54 ` Timur Tabi
2015-11-24 16:55 ` Scott Wood
2015-11-24 16:56 ` Timur Tabi
2015-11-24 16:57 ` Wang Dongsheng
2015-11-24 16:59 ` Scott Wood
2015-11-24 17:00 ` Scott Wood
2015-11-24 17:02 ` Timur Tabi
2015-11-24 17:02 ` Wang Dongsheng
2015-11-24 17:05 ` Timur Tabi
2015-11-24 17:05 ` Scott Wood
2015-11-24 17:06 ` Timur Tabi
2015-11-24 17:10 ` Scott Wood
2015-11-24 17:16 ` Timur Tabi
2015-11-24 17:17 ` Scott Wood
2015-12-01  8:43 ` Wang Dongsheng
2015-12-01 14:53 ` 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).