Skip to content

Commit

Permalink
regulator: arizona-micsupp: Drop OF node reference on error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
charleskeepax authored and broonie committed Feb 21, 2015
1 parent bfa76d4 commit a7b976a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/regulator/arizona-micsupp.c
Expand Up @@ -284,15 +284,16 @@ 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",
ret);
return ret;
}

of_node_put(config.of_node);

platform_set_drvdata(pdev, micsupp);

return 0;
Expand Down

0 comments on commit a7b976a

Please sign in to comment.