kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ASoC: mediatek: mt2701: fix some error handling in probe
@ 2016-07-07  8:14 Dan Carpenter
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-07-07  8:14 UTC (permalink / raw)
  To: Liam Girdwood, Garlic Tseng
  Cc: alsa-devel, kernel-janitors, Takashi Iwai, Mark Brown,
	linux-mediatek, Matthias Brugger

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-07 10:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07  8:14 [patch] ASoC: mediatek: mt2701: fix some error handling in probe Dan Carpenter
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

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).