提交 d1685e4e 编写于 作者: H Heiko Stübner 提交者: Mark Brown

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: NHeiko Stuebner <heiko@sntech.de>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 d162b3c5
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册