From: Jean-Francois Moine <moinejf@free.fr>
To: Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.de>,
Rob Herring <rob.herring@calxeda.com>,
Russell King <rmk+kernel@arm.linux.org.uk>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: [PATCH 2/4] ASoc: kirkwood: simplify probe error
Date: Thu, 25 Jul 2013 11:13:57 +0200 [thread overview]
Message-ID: <20130725111357.7c976963@armhf> (raw)
The function kirkwood_i2s_dev_remove() may be used when probe fails.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
---
sound/soc/kirkwood/kirkwood-i2s.c | 44 +++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 4c9dad3..d3e50af 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -455,6 +455,21 @@ static const struct snd_soc_component_driver kirkwood_i2s_component = {
.name = DRV_NAME,
};
+static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
+{
+ struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
+
+ snd_soc_unregister_component(&pdev->dev);
+
+ if (!IS_ERR(priv->extclk)) {
+ clk_disable_unprepare(priv->extclk);
+ clk_put(priv->extclk);
+ }
+ clk_disable_unprepare(priv->clk);
+
+ return 0;
+}
+
static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
{
struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data;
@@ -525,34 +540,17 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
err = snd_soc_register_component(&pdev->dev, &kirkwood_i2s_component,
soc_dai, 1);
- if (!err)
- return 0;
- dev_err(&pdev->dev, "snd_soc_register_component failed\n");
-
- if (!IS_ERR(priv->extclk)) {
- clk_disable_unprepare(priv->extclk);
- clk_put(priv->extclk);
+ if (err) {
+ dev_err(&pdev->dev, "snd_soc_register_component failed\n");
+ goto fail;
}
- clk_disable_unprepare(priv->clk);
+ return 0;
+fail:
+ kirkwood_i2s_dev_remove(pdev);
return err;
}
-static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
-{
- struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
-
- snd_soc_unregister_component(&pdev->dev);
-
- if (!IS_ERR(priv->extclk)) {
- clk_disable_unprepare(priv->extclk);
- clk_put(priv->extclk);
- }
- clk_disable_unprepare(priv->clk);
-
- return 0;
-}
-
static struct platform_driver kirkwood_i2s_driver = {
.probe = kirkwood_i2s_dev_probe,
.remove = kirkwood_i2s_dev_remove,
--
1.8.3.2
--
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef | http://moinejf.free.fr/
next reply other threads:[~2013-07-25 9:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-25 9:13 Jean-Francois Moine [this message]
2013-07-25 19:10 ` [PATCH 2/4] ASoc: kirkwood: simplify probe error Mark Brown
2013-07-26 6:28 ` Jean-Francois Moine
2013-07-26 10:32 ` Mark Brown
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=20130725111357.7c976963@armhf \
--to=moinejf@free.fr \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=rob.herring@calxeda.com \
--cc=tiwai@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).