Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1263196 > unrolled thread

[PATCH] mfd: syscon: check 'property' before of_node_put

Started byPeng Fan <van.freenix@gmail.com>
First post2015-11-05 14:30 +0100
Last post2015-11-05 14:30 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] mfd: syscon: check 'property' before of_node_put Peng Fan <van.freenix@gmail.com> - 2015-11-05 14:30 +0100

#1263196 — [PATCH] mfd: syscon: check 'property' before of_node_put

FromPeng Fan <van.freenix@gmail.com>
Date2015-11-05 14:30 +0100
Subject[PATCH] mfd: syscon: check 'property' before of_node_put
Message-ID<qrsM1-7f5-11@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web