All of lore.kernel.org
 help / color / mirror / Atom feed
From: Garlic Tseng <garlic.tseng@mediatek.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] ASoC: mediatek: mt2701: fix some error handling in probe
Date: Thu, 07 Jul 2016 08:26:54 +0000	[thread overview]
Message-ID: <1467880014.11610.1.camel@mtksdaap41> (raw)
In-Reply-To: <20160707081404.GB16645@mwanda>

On Thu, 2016-07-07 at 11:14 +0300, Dan Carpenter wrote:
> The check for if the "afe" allocation failed was too late and there
> wasn't a check for "afe->platform_priv".
> 
> Fixes: 43a6a7e71063 ('ASoC: mediatek: add mt2701 platform driver implementation.')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
> index c865ba1..fc5a87d 100644
> --- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
> +++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
> @@ -1350,11 +1350,13 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev)
>  
>  	ret = 0;
>  	afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL);
> +	if (!afe)
> +		return -ENOMEM;
>  	afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv),
>  					  GFP_KERNEL);
> -	afe_priv = afe->platform_priv;
> -	if (!afe)
> +	if (!afe->platform_priv)
>  		return -ENOMEM;
> +	afe_priv = afe->platform_priv;
>  
>  	afe->dev = &pdev->dev;
>  	dev = afe->dev;

Acked-by: Garlic Tseng <garlic.tseng@mediatek.com>


WARNING: multiple messages have this Message-ID (diff)
From: Garlic Tseng <garlic.tseng@mediatek.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [patch] ASoC: mediatek: mt2701: fix some error handling in probe
Date: Thu, 7 Jul 2016 16:26:54 +0800	[thread overview]
Message-ID: <1467880014.11610.1.camel@mtksdaap41> (raw)
In-Reply-To: <20160707081404.GB16645@mwanda>

On Thu, 2016-07-07 at 11:14 +0300, Dan Carpenter wrote:
> The check for if the "afe" allocation failed was too late and there
> wasn't a check for "afe->platform_priv".
> 
> Fixes: 43a6a7e71063 ('ASoC: mediatek: add mt2701 platform driver implementation.')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
> index c865ba1..fc5a87d 100644
> --- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
> +++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
> @@ -1350,11 +1350,13 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev)
>  
>  	ret = 0;
>  	afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL);
> +	if (!afe)
> +		return -ENOMEM;
>  	afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv),
>  					  GFP_KERNEL);
> -	afe_priv = afe->platform_priv;
> -	if (!afe)
> +	if (!afe->platform_priv)
>  		return -ENOMEM;
> +	afe_priv = afe->platform_priv;
>  
>  	afe->dev = &pdev->dev;
>  	dev = afe->dev;

Acked-by: Garlic Tseng <garlic.tseng@mediatek.com>


  reply	other threads:[~2016-07-07  8:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07  8:14 [patch] ASoC: mediatek: mt2701: fix some error handling in probe Dan Carpenter
2016-07-07  8:14 ` Dan Carpenter
2016-07-07  8:26 ` Garlic Tseng [this message]
2016-07-07  8:26   ` Garlic Tseng
2016-07-07 10:01 ` Applied "ASoC: mediatek: mt2701: fix some error handling in probe" to the asoc tree Mark Brown
2016-07-07 10:01   ` 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=1467880014.11610.1.camel@mtksdaap41 \
    --to=garlic.tseng@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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.