mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] regulator: core: Add of_node_get to of_regulator_match
@ 2014-04-03 14:32 Charles Keepax
  2014-04-03 14:32 ` [PATCH 2/3] regulator: core: Add helper to put of_nodes from matches Charles Keepax
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Charles Keepax @ 2014-04-03 14:32 UTC (permalink / raw)
  To: broonie; +Cc: lgirdwood, linux-kernel, patches

Currently, of_regulator_match does not increment the reference count of
the of_nodes it takes new references to. This could cause the node
pointer held to be invalid, by the time it is passed to the regulator
core. This patchs adds an of_node_get when we copy each of_node pointer
into the match structure.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/regulator/of_regulator.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index ea4f36f..c58c8d1 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -119,7 +119,8 @@ EXPORT_SYMBOL_GPL(of_get_regulator_init_data);
  * regulator. The data parsed from a child node will be matched to a regulator
  * based on either the deprecated property regulator-compatible if present,
  * or otherwise the child node's name. Note that the match table is modified
- * in place.
+ * in place and an additional of_node reference is taken for each matched
+ * regulator.
  *
  * Returns the number of matches found or a negative error code on failure.
  */
@@ -162,7 +163,7 @@ int of_regulator_match(struct device *dev, struct device_node *node,
 					child->name);
 				return -EINVAL;
 			}
-			match->of_node = child;
+			match->of_node = of_node_get(child);
 			count++;
 			break;
 		}
-- 
1.7.2.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-04  8:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-03 14:32 [PATCH 1/3] regulator: core: Add of_node_get to of_regulator_match Charles Keepax
2014-04-03 14:32 ` [PATCH 2/3] regulator: core: Add helper to put of_nodes from matches Charles Keepax
2014-04-03 14:32 ` [PATCH 3/3] regulator: core: Get and put regulator of_node Charles Keepax
2014-04-03 21:50 ` [PATCH 1/3] regulator: core: Add of_node_get to of_regulator_match Mark Brown
2014-04-04  8:33   ` Charles Keepax

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome