From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, info@crazy-audio.com,
lgirdwood@gmail.com, patches@opensource.wolfsonmicro.com
Subject: [PATCH 1/2] ASoC: wm8804: Fix small issues in probe error path
Date: Mon, 2 Mar 2015 17:57:54 +0000 [thread overview]
Message-ID: <1425319075-10400-1-git-send-email-ckeepax@opensource.wolfsonmicro.com> (raw)
The regulator notifiers were not being cleared up on the error path in
wm8804_probe and the nothing was being cleared up if
snd_soc_register_codec failed. This patch fixes these issues.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
sound/soc/codecs/wm8804.c | 18 +++++++++++++++---
1 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index 1bd4ace..6131c2a 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -607,6 +607,7 @@ int wm8804_probe(struct device *dev, struct regmap *regmap)
dev_err(dev,
"Failed to register regulator notifier: %d\n",
ret);
+ return ret;
}
}
@@ -614,7 +615,7 @@ int wm8804_probe(struct device *dev, struct regmap *regmap)
wm8804->supplies);
if (ret) {
dev_err(dev, "Failed to enable supplies: %d\n", ret);
- goto err_reg_enable;
+ goto err_reg_notify;
}
ret = regmap_read(regmap, WM8804_RST_DEVID1, &id1);
@@ -651,11 +652,22 @@ 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);
+err_reg_notify:
+ for (i = 0; i < ARRAY_SIZE(wm8804->supplies); ++i)
+ regulator_unregister_notifier(wm8804->supplies[i].consumer,
+ &wm8804->disable_nb[i]);
+
return ret;
}
EXPORT_SYMBOL_GPL(wm8804_probe);
--
1.7.2.5
next reply other threads:[~2015-03-02 17:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-02 17:57 Charles Keepax [this message]
2015-03-02 17:57 ` [PATCH 2/2] ASoC: wm8804: Add DAPM widgets for SPDIF/AIF Charles Keepax
2015-03-02 18:16 ` Mark Brown
2015-03-02 21:35 ` Charles Keepax
2015-03-02 18:03 ` [PATCH 1/2] ASoC: wm8804: Fix small issues in probe error path Mark Brown
2015-03-02 18:15 ` Charles Keepax
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1425319075-10400-1-git-send-email-ckeepax@opensource.wolfsonmicro.com \
--to=ckeepax@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=info@crazy-audio.com \
--cc=lgirdwood@gmail.com \
--cc=patches@opensource.wolfsonmicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.