regulator: core: Release regulator-regulator supplies on error
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 13 May 2012 17:35:56 +0000 (18:35 +0100)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 30 May 2012 23:43:26 +0000 (00:43 +0100)
commit e81dba85c6388dfabcb76cbc2b8bd02836a53ae5 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: Ben Hutchings <ben@decadent.org.uk>
drivers/regulator/core.c

index 938398f..6ec610c 100644 (file)
@@ -2765,6 +2765,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 */