dect
/
linux-2.6
Archived
13
0
Fork 0

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>
This commit is contained in:
Heiko Stübner 2011-10-14 18:00:29 +02:00 committed by Mark Brown
parent d162b3c54b
commit d1685e4e2c
1 changed files with 1 additions and 1 deletions

View File

@ -1425,7 +1425,7 @@ int regulator_enable(struct regulator *regulator)
ret = _regulator_enable(rdev);
mutex_unlock(&rdev->mutex);
if (ret != 0)
if (ret != 0 && rdev->supply)
regulator_disable(rdev->supply);
return ret;