Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1685e4e authored by Heiko Stübner's avatar Heiko Stübner Committed by Mark Brown
Browse files

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: default avatarHeiko Stuebner <heiko@sntech.de>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent d162b3c5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;