Skip to content

Commit b02c5cc

Browse files
Dan Carpenterbroonie
authored andcommitted
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: 43a6a7e ('ASoC: mediatek: add mt2701 platform driver implementation.') Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Garlic Tseng <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 4bdc8d4 commit b02c5cc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sound/soc/mediatek/mt2701/mt2701-afe-pcm.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,11 +1489,13 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev)
14891489

14901490
ret = 0;
14911491
afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL);
1492+
if (!afe)
1493+
return -ENOMEM;
14921494
afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv),
14931495
GFP_KERNEL);
1494-
afe_priv = afe->platform_priv;
1495-
if (!afe)
1496+
if (!afe->platform_priv)
14961497
return -ENOMEM;
1498+
afe_priv = afe->platform_priv;
14971499

14981500
afe->dev = &pdev->dev;
14991501
dev = afe->dev;

0 commit comments

Comments
 (0)