regulator: arizona-micsupp: Drop OF node reference on error path
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Fri, 20 Feb 2015 16:08:44 +0000 (16:08 +0000)
committerMark Brown <broonie@kernel.org>
Sat, 21 Feb 2015 14:30:30 +0000 (23:30 +0900)
We were not calling of_node_put if the regulator failed to register this
patch fixes this.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/arizona-micsupp.c

index 20079006459af5a89e324e9e595e67d1df5a40d7..4116e74effa4e5a5f371c9a579bb0c97dee9d55f 100644 (file)
@@ -284,6 +284,9 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
        micsupp->regulator = devm_regulator_register(&pdev->dev,
                                                     desc,
                                                     &config);
+
+       of_node_put(config.of_node);
+
        if (IS_ERR(micsupp->regulator)) {
                ret = PTR_ERR(micsupp->regulator);
                dev_err(arizona->dev, "Failed to register mic supply: %d\n",
@@ -291,8 +294,6 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
                return ret;
        }
 
-       of_node_put(config.of_node);
-
        platform_set_drvdata(pdev, micsupp);
 
        return 0;