diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-01-27 21:16:56 +0800 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-01-30 18:50:27 +0800 |
commit | c92f5dd2c42fa61e0ef810fad4584b184ea2d50e (patch) | |
tree | c0d7f598b23259342ea4e912607156fb7acef2d2 /drivers/regulator/mc13xxx-regulator-core.c | |
parent | 9c9588a7326bdebf49f5d205dd4243c0d1df73d5 (diff) | |
download | op-kernel-dev-c92f5dd2c42fa61e0ef810fad4584b184ea2d50e.zip op-kernel-dev-c92f5dd2c42fa61e0ef810fad4584b184ea2d50e.tar.gz |
regulator: Add missing of_node_put()
of_find_node_by_name() returns a node pointer with refcount incremented, use
of_node_put() on it when done.
of_find_node_by_name() will call of_node_put() against from parameter,
thus we also need to call of_node_get(from) before calling
of_find_node_by_name().
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/mc13xxx-regulator-core.c')
-rw-r--r-- | drivers/regulator/mc13xxx-regulator-core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index 2ecf1d8..5d2ab2e 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c @@ -175,6 +175,7 @@ int mc13xxx_get_num_regulators_dt(struct platform_device *pdev) for_each_child_of_node(parent, child) num++; + of_node_put(parent); return num; } EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt); @@ -197,8 +198,11 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( data = devm_kzalloc(&pdev->dev, sizeof(*data) * priv->num_regulators, GFP_KERNEL); - if (!data) + if (!data) { + of_node_put(parent); return NULL; + } + p = data; for_each_child_of_node(parent, child) { @@ -217,6 +221,7 @@ struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt( } } } + of_node_put(parent); *num_parsed = parsed; return data; |