Skip to contentSkip to conversation

mfd: syscon: check 'property' before of_node_put

PATCH New Peng Fan 1 participant 1 message Nov 5, 2015

Subsystems (2)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 mfd: syscon: check 'property' before of_node_put

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.

Cc Lee Jones <[email protected]>
Cc Arnd Bergmann <[email protected]>
---
 drivers/mfd/syscon.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/syscon.c +3 -1
index 176bf0f..fab36bc 100644
@@ -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;
 }
Signature · 1 line
1.8.4