regulator: core: Release regulator-regulator supplies on error

commit e81dba85c6 upstream.

If we fail while registering a regulator make sure we release the supply
for the regulator if there is one.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Mark Brown 2012-05-13 18:35:56 +01:00 committed by Greg Kroah-Hartman
parent 4c68b0f805
commit 538926ed48

View File

@ -2971,6 +2971,8 @@ struct regulator_dev *regulator_register(struct regulator_desc *regulator_desc,
unset_regulator_supplies(rdev);
scrub:
if (rdev->supply)
regulator_put(rdev->supply);
kfree(rdev->constraints);
device_unregister(&rdev->dev);
/* device core frees rdev */