From: Peng Fan <van.freenix@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: van.freenix@gmail.com, Lee Jones <lee.jones@linaro.org>,
Arnd Bergmann <arnd@arndb.de>
Subject: [PATCH] mfd: syscon: check 'property' before of_node_put
Date: Thu, 5 Nov 2015 21:23:35 +0800 [thread overview]
Message-ID: <1446729815-25473-1-git-send-email-van.freenix@gmail.com> (raw)
When 'property' is not NULL, of_parse_phandle will return the
node pointer with refcount incremented. So when of_node_put,
also need to check property.
Signed-off-by: Peng Fan <van.freenix@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
---
drivers/mfd/syscon.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 176bf0f..fab36bc 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -168,7 +168,9 @@ struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np,
return ERR_PTR(-ENODEV);
regmap = syscon_node_to_regmap(syscon_np);
- of_node_put(syscon_np);
+
+ if (property)
+ of_node_put(syscon_np);
return regmap;
}
--
1.8.4
reply other threads:[~2015-11-05 13:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1446729815-25473-1-git-send-email-van.freenix@gmail.com \
--to=van.freenix@gmail.com \
--cc=arnd@arndb.de \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@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