Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1384408
| From | Jon Hunter <jonathanh@nvidia.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/5] regulator: core: Clear the supply pointer if enabling fails |
| Date | 2016-04-21 18:20 +0200 |
| Message-ID | <rqpuH-3tV-17@gated-at.bofh.it> (permalink) |
| References | <rqpuH-3tV-15@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
During the resolution of a regulator's supply, we may attempt to enable
the supply if the regulator itself is already enabled. If enabling the
supply fails, then we will call _regulator_put() for the supply.
However, the pointer to the supply has not been cleared for the
regulator and this will cause a crash if we then unregister the
regulator and attempt to call regulator_put() a second time for the
supply. Fix this by clearing the supply pointer if enabling the supply
after fails when resolving the supply for a regulator.
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
drivers/regulator/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a0b52ef11c30..39d05fcc07e9 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1545,6 +1545,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
ret = regulator_enable(rdev->supply);
if (ret < 0) {
_regulator_put(rdev->supply);
+ rdev->supply = NULL;
return ret;
}
}
--
2.1.4
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH 2/5] regulator: core: Clear the supply pointer if enabling fails Jon Hunter <jonathanh@nvidia.com> - 2016-04-21 18:20 +0200 Applied "regulator: core: Clear the supply pointer if enabling fails" to the regulator tree Mark Brown <broonie@kernel.org> - 2016-04-22 13:00 +0200
csiph-web