From: Jon Hunter <jonathanh@nvidia.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>,
Alexandre Courbot <gnurou@gmail.com>
Cc: linux-tegra@vger.kernel.org, linux-gpio@vger.kernel.org,
Jon Hunter <jonathanh@nvidia.com>
Subject: [PATCH 3/3] pinctrl: tegra-xusb: Check that of_match_node returns a valid pointer
Date: Tue, 19 May 2015 15:14:23 +0100 [thread overview]
Message-ID: <1432044863-2035-4-git-send-email-jonathanh@nvidia.com> (raw)
In-Reply-To: <1432044863-2035-1-git-send-email-jonathanh@nvidia.com>
of_match_node() will return NULL if no match is found and so check for
this before dereferencing the pointer.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
drivers/pinctrl/pinctrl-tegra-xusb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/pinctrl-tegra-xusb.c b/drivers/pinctrl/pinctrl-tegra-xusb.c
index c61594066e26..0030cfb9c0a8 100644
--- a/drivers/pinctrl/pinctrl-tegra-xusb.c
+++ b/drivers/pinctrl/pinctrl-tegra-xusb.c
@@ -899,6 +899,9 @@ static int tegra_xusb_padctl_probe(struct platform_device *pdev)
padctl->dev = &pdev->dev;
match = of_match_node(tegra_xusb_padctl_of_match, pdev->dev.of_node);
+ if (!match)
+ return -EINVAL;
+
padctl->soc = match->data;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
--
1.9.1
next prev parent reply other threads:[~2015-05-19 14:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 14:14 [PATCH 0/3] pinctrl: tegra-xusb: Clean-up and fixes Jon Hunter
[not found] ` <1432044863-2035-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-05-19 14:14 ` [PATCH 1/3] pinctrl: tegra-xusb: Remove unused structure Jon Hunter
2015-05-19 14:20 ` Thierry Reding
2015-05-19 14:14 ` [PATCH 2/3] pinctrl: tegra-xusb: Fix allocation of pins Jon Hunter
[not found] ` <1432044863-2035-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2015-05-19 14:30 ` Thierry Reding
[not found] ` <20150519143041.GD26748-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-05-19 15:09 ` Jon Hunter
2015-05-19 14:33 ` Thierry Reding
[not found] ` <20150519143340.GE26748-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-05-19 15:23 ` Jon Hunter
2015-05-20 15:04 ` Thierry Reding
2015-05-19 14:14 ` Jon Hunter [this message]
2015-05-19 14:18 ` [PATCH 3/3] pinctrl: tegra-xusb: Check that of_match_node returns a valid pointer Thierry Reding
[not found] ` <20150519141836.GB26748-AwZRO8vwLAwmlAP/+Wk3EA@public.gmane.org>
2015-05-19 14:29 ` Jon Hunter
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=1432044863-2035-4-git-send-email-jonathanh@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=gnurou@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
/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).