From: Dongsheng Wang <dongsheng.wang@freescale.com>
To: linux-fbdev@vger.kernel.org
Subject: [PATCH v2] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented
Date: Wed, 02 Dec 2015 13:20:16 +0000 [thread overview]
Message-ID: <1449062416-12245-1-git-send-email-dongsheng.wang@freescale.com> (raw)
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
next reply other threads:[~2015-12-02 13:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 13:20 Dongsheng Wang [this message]
2015-12-03 1:12 ` [PATCH v2] video: fbdev: fsl: fix kernel crash when diu_ops is not implemented Timur Tabi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449062416-12245-1-git-send-email-dongsheng.wang@freescale.com \
--to=dongsheng.wang@freescale.com \
--cc=linux-fbdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).