diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2016-07-07 10:14:04 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-07-07 11:40:58 +0200 |
commit | b02c5cc7239b8f58ba5da24092288dd7a9a56acc (patch) | |
tree | 89dda426094addc91a2a44078f7c17929c3b83de /sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | |
parent | ASoC: mediatek: add BT implementation (diff) | |
download | linux-b02c5cc7239b8f58ba5da24092288dd7a9a56acc.tar.xz linux-b02c5cc7239b8f58ba5da24092288dd7a9a56acc.zip |
ASoC: mediatek: mt2701: fix some error handling in probe
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>
Acked-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/mediatek/mt2701/mt2701-afe-pcm.c')
-rw-r--r-- | sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c index 6c14d686bfa1..15522c08a967 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c @@ -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; |