27 lines
987 B
Diff
27 lines
987 B
Diff
commit d1685e4e2c3854782272f32b71f2f3eff5c6e0d0
|
|
Author: Heiko Stübner <heiko@sntech.de>
|
|
Date: Fri Oct 14 18:00:29 2011 +0200
|
|
|
|
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>
|
|
|
|
Index: source/drivers/regulator/core.c
|
|
===================================================================
|
|
--- source.orig/drivers/regulator/core.c 2011-11-28 22:48:14.000000000 +0000
|
|
+++ source/drivers/regulator/core.c 2011-12-03 23:01:59.000000000 +0000
|
|
@@ -1425,7 +1425,7 @@
|
|
ret = _regulator_enable(rdev);
|
|
mutex_unlock(&rdev->mutex);
|
|
|
|
- if (ret != 0)
|
|
+ if (ret != 0 && rdev->supply)
|
|
regulator_disable(rdev->supply);
|
|
|
|
return ret;
|