From: Lars-Peter Clausen <lars@metafoo.de>
To: Peter Ujfalusi <peter.ujfalusi@ti.com>
Cc: alsa-devel@alsa-project.org, Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: Re: [PATCH 6/6] ASoC: omap-dmic: Cleanup the probe function
Date: Thu, 11 Jul 2013 13:10:02 +0200 [thread overview]
Message-ID: <51DE928A.4090402@metafoo.de> (raw)
In-Reply-To: <1373537930-10467-7-git-send-email-peter.ujfalusi@ti.com>
On 07/11/2013 12:18 PM, Peter Ujfalusi wrote:
> Move the clk_get later in the function. In this way we do not need to use
> goto in other error cases.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
How about using devm_clk_get?
> ---
> sound/soc/omap/omap-dmic.c | 24 +++++++++---------------
> 1 file changed, 9 insertions(+), 15 deletions(-)
>
> diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
> index f66b033..1b6c507 100644
> --- a/sound/soc/omap/omap-dmic.c
> +++ b/sound/soc/omap/omap-dmic.c
> @@ -463,17 +463,10 @@ static int asoc_dmic_probe(struct platform_device *pdev)
>
> mutex_init(&dmic->mutex);
>
> - dmic->fclk = clk_get(dmic->dev, "fck");
> - if (IS_ERR(dmic->fclk)) {
> - dev_err(dmic->dev, "cant get fck\n");
> - return -ENODEV;
> - }
> -
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
> if (!res) {
> dev_err(dmic->dev, "invalid dma memory resource\n");
> - ret = -ENODEV;
> - goto err_put_clk;
> + return -ENODEV;
> }
> dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;
>
> @@ -482,23 +475,24 @@ static int asoc_dmic_probe(struct platform_device *pdev)
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
> if (!res) {
> dev_err(dmic->dev, "invalid memory resource\n");
> - ret = -ENODEV;
> - goto err_put_clk;
> + return -ENODEV;
> }
>
> dmic->io_base = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR(dmic->io_base))
> return PTR_ERR(dmic->io_base);
>
> + dmic->fclk = clk_get(dmic->dev, "fck");
> + if (IS_ERR(dmic->fclk)) {
> + dev_err(dmic->dev, "cant get fck\n");
> + return -ENODEV;
> + }
> +
> ret = snd_soc_register_component(&pdev->dev, &omap_dmic_component,
> &omap_dmic_dai, 1);
> if (ret)
> - goto err_put_clk;
> -
> - return 0;
> + clk_put(dmic->fclk);
>
> -err_put_clk:
> - clk_put(dmic->fclk);
> return ret;
> }
>
next prev parent reply other threads:[~2013-07-11 11:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-11 10:18 [PATCH 0/6] ASoC: Regression fix for OMAP in DT boot (3.11) Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 1/6] ASoC: dmaengine_pcm: Add dma_name to snd_dmaengine_dai_dma_data Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 2/6] ASoC: omap-pcm: Request the DMA channel by name when dma_name is set for the dai Peter Ujfalusi
2013-07-11 11:13 ` Lars-Peter Clausen
2013-07-11 12:30 ` Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 3/6] ASoC: omap-mcpdm: Do not use platform_get_resource_byname() for DMA Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 4/6] ASoC: omap-dmic: " Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 5/6] ASoC: omap-mcbsp: Use different method for DMA request when booted with DT Peter Ujfalusi
2013-07-11 10:18 ` [PATCH 6/6] ASoC: omap-dmic: Cleanup the probe function Peter Ujfalusi
2013-07-11 11:10 ` Lars-Peter Clausen [this message]
2013-07-11 12:31 ` Peter Ujfalusi
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=51DE928A.4090402@metafoo.de \
--to=lars@metafoo.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=jarkko.nikula@bitmer.com \
--cc=lgirdwood@gmail.com \
--cc=peter.ujfalusi@ti.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