public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Axel Lin <axel.lin@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Liam Girdwood <lrg@slimlogic.co.uk>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	alsa-devel@alsa-project.org
Subject: Re: [PATCH 7/8] ASoC: imx-ssi: fix resource leak
Date: Thu, 25 Nov 2010 10:19:03 +0100	[thread overview]
Message-ID: <20101125091903.GT6017@pengutronix.de> (raw)
In-Reply-To: <1290669189.30158.20.camel@mola>

On Thu, Nov 25, 2010 at 03:13:09PM +0800, Axel Lin wrote:
> Fix imx_ssi_probe() error path and imx_ssi_remove() to properly free
> allocated resources.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

> ---
>  sound/soc/imx/imx-ssi.c |   15 +++++++++++----
>  1 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
> index ad21f81..30894ea 100644
> --- a/sound/soc/imx/imx-ssi.c
> +++ b/sound/soc/imx/imx-ssi.c
> @@ -679,8 +679,11 @@ static int imx_ssi_probe(struct platform_device *pdev)
>  	}
>  
>  	ssi->soc_platform_pdev_fiq = platform_device_alloc("imx-fiq-pcm-audio", pdev->id);
> -	if (!ssi->soc_platform_pdev_fiq)
> +	if (!ssi->soc_platform_pdev_fiq) {
> +		ret = -ENOMEM;
>  		goto failed_pdev_fiq_alloc;
> +	}
> +
>  	platform_set_drvdata(ssi->soc_platform_pdev_fiq, ssi);
>  	ret = platform_device_add(ssi->soc_platform_pdev_fiq);
>  	if (ret) {
> @@ -689,8 +692,11 @@ static int imx_ssi_probe(struct platform_device *pdev)
>  	}
>  
>  	ssi->soc_platform_pdev = platform_device_alloc("imx-pcm-audio", pdev->id);
> -	if (!ssi->soc_platform_pdev)
> +	if (!ssi->soc_platform_pdev) {
> +		ret = -ENOMEM;
>  		goto failed_pdev_alloc;
> +	}
> +
>  	platform_set_drvdata(ssi->soc_platform_pdev, ssi);
>  	ret = platform_device_add(ssi->soc_platform_pdev);
>  	if (ret) {
> @@ -703,6 +709,7 @@ static int imx_ssi_probe(struct platform_device *pdev)
>  failed_pdev_add:
>  	platform_device_put(ssi->soc_platform_pdev);
>  failed_pdev_alloc:
> +	platform_device_del(ssi->soc_platform_pdev_fiq);
>  failed_pdev_fiq_add:
>  	platform_device_put(ssi->soc_platform_pdev_fiq);
>  failed_pdev_fiq_alloc:
> @@ -726,8 +733,8 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
>  	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	struct imx_ssi *ssi = platform_get_drvdata(pdev);
>  
> -	platform_device_del(ssi->soc_platform_pdev);
> -	platform_device_put(ssi->soc_platform_pdev);
> +	platform_device_unregister(ssi->soc_platform_pdev);
> +	platform_device_unregister(ssi->soc_platform_pdev_fiq);
>  
>  	snd_soc_unregister_dai(&pdev->dev);
>  
> -- 
> 1.7.2
> 
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2010-11-25  9:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-25  7:06 [PATCH 0/8] ASoC: fix resource leak in error paths Axel Lin
2010-11-25  7:07 ` [PATCH 1/8] ASoC: efika-audio-fabric: fix resource leak in efika_fabric_init error path Axel Lin
2010-11-25  7:08 ` [PATCH 2/8] ASoC: pcm030-audio-fabric: fix resource leak in pcm030_fabric_init " Axel Lin
2010-11-25  7:10 ` [PATCH 3/8] ASoC: snd-soc-afeb9260: remove unneeded platform_device_del in " Axel Lin
2010-11-25  7:11 ` [PATCH 4/8] ASoC: sam9g20_wm8731: fix resource leak in at91sam9g20ek_init " Axel Lin
2010-11-25  7:11 ` [PATCH 5/8] ASoC: smdk_wm9713: fix resource leak in smdk_init " Axel Lin
2010-11-25  7:12 ` [PATCH 6/8] ASoC: simone: fix resource leak in simone_init " Axel Lin
2010-11-25  8:06   ` Mika Westerberg
2010-11-25  7:13 ` [PATCH 7/8] ASoC: imx-ssi: fix resource leak Axel Lin
2010-11-25  9:19   ` Sascha Hauer [this message]
2010-11-25  7:14 ` [PATCH 8/8] ASoC: phycore-ac97: " Axel Lin
2010-11-25  9:19   ` Sascha Hauer
2010-11-25 10:47 ` [PATCH 0/8] ASoC: fix resource leak in error paths Liam Girdwood
2010-11-25 11:14 ` 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=20101125091903.GT6017@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=axel.lin@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@slimlogic.co.uk \
    /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