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 44f289c7e6
commit 4666b31d6d

View File

@ -2877,6 +2877,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 */