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)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 14 May 2012 08:31:35 +0000 (09:31 +0100)
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>
Cc: stable@vger.kernel.org
drivers/regulator/core.c

index 8918271f9e85b20eff09e84398bc74b54645819d..5a33282181d84acf90d9ae4b4e9cdd738603aecf 100644 (file)
@@ -3193,6 +3193,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 */