diff options
author | Heiko Stübner <heiko@sntech.de> | 2011-10-14 12:00:29 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-10-14 15:47:06 -0400 |
commit | d1685e4e2c3854782272f32b71f2f3eff5c6e0d0 (patch) | |
tree | f5a3db39e444233ce989216ded33b9542e0a0921 /drivers/regulator/core.c | |
parent | d162b3c54b206ee64c87651309ed4442846cafbc (diff) |
regulator: Fix possible nullpointer dereference in regulator_enable()
In the case where _regulator_enable returns an error it was not checked
if a supplying regulator exists before trying to disable it, leading
to a null pointer-dereference if no supplying regulator existed.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 9a33fe2021b6..87d9328f1695 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -1425,7 +1425,7 @@ int regulator_enable(struct regulator *regulator) | |||
1425 | ret = _regulator_enable(rdev); | 1425 | ret = _regulator_enable(rdev); |
1426 | mutex_unlock(&rdev->mutex); | 1426 | mutex_unlock(&rdev->mutex); |
1427 | 1427 | ||
1428 | if (ret != 0) | 1428 | if (ret != 0 && rdev->supply) |
1429 | regulator_disable(rdev->supply); | 1429 | regulator_disable(rdev->supply); |
1430 | 1430 | ||
1431 | return ret; | 1431 | return ret; |