From: Fabio Estevam <festevam@gmail.com>
To: alsa-devel@alsa-project.org
Cc: Fabio Estevam <fabio.estevam@freescale.com>,
broonie@opensource.wolfsonmicro.com,
Fabio Estevam <festevam@gmail.com>
Subject: [PATCH] ASoC: mxs-saif: Use devm_clk_get()
Date: Thu, 26 Apr 2012 01:33:22 -0300 [thread overview]
Message-ID: <1335414802-4972-1-git-send-email-festevam@gmail.com> (raw)
Using devm_clk_get() can make the error handling path easier.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
sound/soc/mxs/mxs-saif.c | 20 +++++++-------------
1 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 53f4fd8..bfc1f9e 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -650,7 +650,7 @@ static int mxs_saif_probe(struct platform_device *pdev)
saif->master_id = saif->id;
}
- saif->clk = clk_get(&pdev->dev, NULL);
+ saif->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(saif->clk)) {
ret = PTR_ERR(saif->clk);
dev_err(&pdev->dev, "Cannot get the clock: %d\n",
@@ -663,16 +663,14 @@ static int mxs_saif_probe(struct platform_device *pdev)
saif->base = devm_request_and_ioremap(&pdev->dev, iores);
if (!saif->base) {
dev_err(&pdev->dev, "ioremap failed\n");
- ret = -ENODEV;
- goto failed_get_resource;
+ return -ENODEV;
}
dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!dmares) {
- ret = -ENODEV;
dev_err(&pdev->dev, "failed to get dma resource: %d\n",
ret);
- goto failed_get_resource;
+ return -ENODEV;
}
saif->dma_param.chan_num = dmares->start;
@@ -681,7 +679,7 @@ static int mxs_saif_probe(struct platform_device *pdev)
ret = saif->irq;
dev_err(&pdev->dev, "failed to get irq resource: %d\n",
ret);
- goto failed_get_resource;
+ return saif->irq;
}
saif->dev = &pdev->dev;
@@ -689,15 +687,14 @@ static int mxs_saif_probe(struct platform_device *pdev)
"mxs-saif", saif);
if (ret) {
dev_err(&pdev->dev, "failed to request irq\n");
- goto failed_get_resource;
+ return ret;
}
saif->dma_param.chan_irq = platform_get_irq(pdev, 1);
if (saif->dma_param.chan_irq < 0) {
- ret = saif->dma_param.chan_irq;
dev_err(&pdev->dev, "failed to get dma irq resource: %d\n",
ret);
- goto failed_get_resource;
+ return saif->dma_param.chan_irq;
}
platform_set_drvdata(pdev, saif);
@@ -705,7 +702,7 @@ static int mxs_saif_probe(struct platform_device *pdev)
ret = snd_soc_register_dai(&pdev->dev, &mxs_saif_dai);
if (ret) {
dev_err(&pdev->dev, "register DAI failed\n");
- goto failed_get_resource;
+ return ret;
}
saif->soc_platform_pdev = platform_device_alloc(
@@ -728,8 +725,6 @@ failed_pdev_add:
platform_device_put(saif->soc_platform_pdev);
failed_pdev_alloc:
snd_soc_unregister_dai(&pdev->dev);
-failed_get_resource:
- clk_put(saif->clk);
return ret;
}
@@ -740,7 +735,6 @@ static int __devexit mxs_saif_remove(struct platform_device *pdev)
platform_device_unregister(saif->soc_platform_pdev);
snd_soc_unregister_dai(&pdev->dev);
- clk_put(saif->clk);
return 0;
}
--
1.7.1
next reply other threads:[~2012-04-26 4:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-26 4:33 Fabio Estevam [this message]
2012-04-26 9:25 ` [PATCH] ASoC: mxs-saif: Use devm_clk_get() Mark Brown
2012-04-26 11:35 ` Fabio Estevam
2012-04-26 11:43 ` Mark Brown
-- strict thread matches above, loose matches on Subject: below --
2012-08-07 4:29 Fabio Estevam
2012-08-07 14:11 ` 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=1335414802-4972-1-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=fabio.estevam@freescale.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 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).