diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2015-03-05 10:39:22 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-05 11:51:58 -0500 |
commit | fcf638f9953eb7f3b97fad7e970ae59dcdbd70c1 (patch) | |
tree | 6a5ea022aa33f0081cb804ab4cb56be08873aa71 /sound/soc | |
parent | 0be9653a02830637ed385d99bf898d456e8eae8f (diff) |
ASoC: wm8804: Fix small issues in probe error paths
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>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/wm8804.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c index 7804ddf53a04..f44da83f50dc 100644 --- a/sound/soc/codecs/wm8804.c +++ b/sound/soc/codecs/wm8804.c | |||
@@ -609,6 +609,7 @@ int wm8804_probe(struct device *dev, struct regmap *regmap) | |||
609 | dev_err(dev, | 609 | dev_err(dev, |
610 | "Failed to register regulator notifier: %d\n", | 610 | "Failed to register regulator notifier: %d\n", |
611 | ret); | 611 | ret); |
612 | return ret; | ||
612 | } | 613 | } |
613 | } | 614 | } |
614 | 615 | ||
@@ -616,7 +617,7 @@ int wm8804_probe(struct device *dev, struct regmap *regmap) | |||
616 | wm8804->supplies); | 617 | wm8804->supplies); |
617 | if (ret) { | 618 | if (ret) { |
618 | dev_err(dev, "Failed to enable supplies: %d\n", ret); | 619 | dev_err(dev, "Failed to enable supplies: %d\n", ret); |
619 | goto err_reg_enable; | 620 | return ret; |
620 | } | 621 | } |
621 | 622 | ||
622 | ret = regmap_read(regmap, WM8804_RST_DEVID1, &id1); | 623 | ret = regmap_read(regmap, WM8804_RST_DEVID1, &id1); |
@@ -653,8 +654,14 @@ int wm8804_probe(struct device *dev, struct regmap *regmap) | |||
653 | goto err_reg_enable; | 654 | goto err_reg_enable; |
654 | } | 655 | } |
655 | 656 | ||
656 | return snd_soc_register_codec(dev, &soc_codec_dev_wm8804, | 657 | ret = snd_soc_register_codec(dev, &soc_codec_dev_wm8804, |
657 | &wm8804_dai, 1); | 658 | &wm8804_dai, 1); |
659 | if (ret < 0) { | ||
660 | dev_err(dev, "Failed to register CODEC: %d\n", ret); | ||
661 | goto err_reg_enable; | ||
662 | } | ||
663 | |||
664 | return 0; | ||
658 | 665 | ||
659 | err_reg_enable: | 666 | err_reg_enable: |
660 | regulator_bulk_disable(ARRAY_SIZE(wm8804->supplies), wm8804->supplies); | 667 | regulator_bulk_disable(ARRAY_SIZE(wm8804->supplies), wm8804->supplies); |