regulator: core: Release regulator-regulator supplies on error
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 <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Cc: [email protected]
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 8918271..5a33282 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3193,6 +3193,8 @@
unset_regulator_supplies(rdev);
scrub:
+ if (rdev->supply)
+ regulator_put(rdev->supply);
kfree(rdev->constraints);
device_unregister(&rdev->dev);
/* device core frees rdev */