[PATCH] regulator: core: Release regulator-regulator supplies on error

From: Mark Brown
Date: Sun May 13 2012 - 13:37:12 EST


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@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
---
drivers/regulator/core.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a3cfaea..28b9c31 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3196,6 +3196,8 @@ unset_supplies:
unset_regulator_supplies(rdev);

scrub:
+ if (rdev->supply)
+ regulator_put(rdev->supply);
kfree(rdev->constraints);
device_unregister(&rdev->dev);
/* device core frees rdev */
--
1.7.10

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/