Skip to content

Commit

Permalink
ASoC: mediatek: mt2701: fix some error handling in probe
Browse files Browse the repository at this point in the history
The check for if the "afe" allocation failed was too late and there
wasn't a check for "afe->platform_priv".

Fixes: 43a6a7e ('ASoC: mediatek: add mt2701 platform driver implementation.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Dan Carpenter authored and Mark Brown committed Jul 7, 2016
1 parent 4bdc8d4 commit b02c5cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,11 +1489,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;
Expand Down

0 comments on commit b02c5cc

Please sign in to comment.