linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: syscon: check 'property' before of_node_put
@ 2015-11-05 13:23 Peng Fan
  0 siblings, 0 replies; only message in thread
From: Peng Fan @ 2015-11-05 13:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: van.freenix, Lee Jones, Arnd Bergmann

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-05 13:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-05 13:23 [PATCH] mfd: syscon: check 'property' before of_node_put Peng Fan

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).