From: axel.lin@ingics.com (Axel Lin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] pinctrl: dove: Prevent NULL dereference if of_match_device returns NULL
Date: Thu, 15 Nov 2012 12:51:36 +0800 [thread overview]
Message-ID: <1352955096.6793.1.camel@phoenix> (raw)
of_match_device() may return NULL.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/pinctrl/mvebu/pinctrl-dove.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c
index ffe74b2..a8b9b42 100644
--- a/drivers/pinctrl/mvebu/pinctrl-dove.c
+++ b/drivers/pinctrl/mvebu/pinctrl-dove.c
@@ -578,8 +578,12 @@ static struct of_device_id dove_pinctrl_of_match[] __devinitdata = {
static int __devinit dove_pinctrl_probe(struct platform_device *pdev)
{
- const struct of_device_id *match =
- of_match_device(dove_pinctrl_of_match, &pdev->dev);
+ const struct of_device_id *match;
+
+ match = of_match_device(dove_pinctrl_of_match, &pdev->dev);
+ if (!match)
+ return -ENODEV;
+
pdev->dev.platform_data = match->data;
/*
--
1.7.9.5
next reply other threads:[~2012-11-15 4:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-15 4:51 Axel Lin [this message]
2012-11-15 4:52 ` [PATCH 2/4] pinctrl: kirkwood: Prevent NULL dereference if of_match_device returns NULL Axel Lin
2012-11-15 19:18 ` Thomas Petazzoni
2012-11-15 4:54 ` [PATCH 3/4] pinctrl: at91: " Axel Lin
2012-11-15 4:58 ` [PATCH RESEND " Axel Lin
2012-11-15 8:23 ` Nicolas Ferre
2012-11-15 10:00 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 8:36 ` Nicolas Ferre
2012-11-16 9:39 ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-15 4:56 ` [PATCH 4/4] pinctrl: nomadik: " Axel Lin
2012-11-15 14:42 ` Linus Walleij
2012-11-15 15:15 ` Lee Jones
2012-11-15 7:35 ` [PATCH 1/4] pinctrl: dove: " Thomas Petazzoni
2012-11-15 13:44 ` Axel Lin
2012-11-15 13:56 ` Thomas Petazzoni
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=1352955096.6793.1.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=linux-arm-kernel@lists.infradead.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).