diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-07 06:34:52 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-05-07 08:14:44 -0400 |
commit | 968c2c1707a3396ccd6e7e6c5ddaf658a6d3bd66 (patch) | |
tree | 5c593bc221011a1b3cdc90ecbb034c656bcf06d7 /drivers/regulator/core.c | |
parent | f55205f4d4a8823a11bb8b37ef2ecbd78fb09463 (diff) |
regulator: Actually free the regulator in devm_regulator_put()
It turns out that (quite surprisingly) devres_destroy() only undoes the
devres mapping, it doesn't destroy the underlying resource, meaning that
anything using devm_regulator_put() would leak. While we wait for the new
devres_release() which does what we want to get merged open code it in
devm_regulator_put().
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e70dd382a009..046fb1bd8619 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -1431,7 +1431,10 @@ void devm_regulator_put(struct regulator *regulator) | |||
1431 | 1431 | ||
1432 | rc = devres_destroy(regulator->dev, devm_regulator_release, | 1432 | rc = devres_destroy(regulator->dev, devm_regulator_release, |
1433 | devm_regulator_match, regulator); | 1433 | devm_regulator_match, regulator); |
1434 | WARN_ON(rc); | 1434 | if (rc == 0) |
1435 | regulator_put(regulator); | ||
1436 | else | ||
1437 | WARN_ON(rc); | ||
1435 | } | 1438 | } |
1436 | EXPORT_SYMBOL_GPL(devm_regulator_put); | 1439 | EXPORT_SYMBOL_GPL(devm_regulator_put); |
1437 | 1440 | ||