2012-05-13 17:37:10

by Mark Brown

[permalink] [raw]
Subject: [PATCH] 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]>
---
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


2012-05-14 08:22:34

by Liam Girdwood

[permalink] [raw]
Subject: Re: [PATCH] regulator: core: Release regulator-regulator supplies on error

On Sun, 2012-05-13 at 18:37 +0100, Mark Brown wrote:
> 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]>