Skip to content

Commit

Permalink
ASoC: wm8804: Fix small issues in probe error paths
Browse files Browse the repository at this point in the history
This patch fixes some small issues on the probe error paths. Firstly,
fail probe if we can't register the regulator notifiers as this
will cause the cache to never be synchronised which will result in odd
behaviour if the regulators are controllable. Secondly, we don't need to
call regulator_bulk_disable if the enable fails, because the regulator
core will handle this clean up for us. Finally, we need to disable the
regulators if snd_soc_register_codecs fails.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Charles Keepax authored and Mark Brown committed Mar 5, 2015
1 parent 0be9653 commit fcf638f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions sound/soc/codecs/wm8804.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,14 +609,15 @@ int wm8804_probe(struct device *dev, struct regmap *regmap)
dev_err(dev,
"Failed to register regulator notifier: %d\n",
ret);
return ret;
}
}

ret = regulator_bulk_enable(ARRAY_SIZE(wm8804->supplies),
wm8804->supplies);
if (ret) {
dev_err(dev, "Failed to enable supplies: %d\n", ret);
goto err_reg_enable;
return ret;
}

ret = regmap_read(regmap, WM8804_RST_DEVID1, &id1);
Expand Down Expand Up @@ -653,8 +654,14 @@ int wm8804_probe(struct device *dev, struct regmap *regmap)
goto err_reg_enable;
}

return snd_soc_register_codec(dev, &soc_codec_dev_wm8804,
&wm8804_dai, 1);
ret = snd_soc_register_codec(dev, &soc_codec_dev_wm8804,
&wm8804_dai, 1);
if (ret < 0) {
dev_err(dev, "Failed to register CODEC: %d\n", ret);
goto err_reg_enable;
}

return 0;

err_reg_enable:
regulator_bulk_disable(ARRAY_SIZE(wm8804->supplies), wm8804->supplies);
Expand Down

0 comments on commit fcf638f

Please sign in to comment.