From 34787d0a258ebb3686676fb37a9e8717cbdd835a Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Thu, 9 Jan 2014 17:49:40 +0800 Subject: [PATCH] ASoC: simple-card: fix the cinfo error check If the dt is used and the cinfo is NULL, the -ENOMEM should be return. Signed-off-by: Xiubo Li Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 6c61b1758f78..11030a63b811 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -211,15 +211,17 @@ static int asoc_simple_card_probe(struct platform_device *pdev) dev_err(dev, "parse error %d\n", ret); return ret; } + } else { + return -ENOMEM; } } else { cinfo = pdev->dev.platform_data; - cinfo->snd_card.dev = &pdev->dev; - } + if (!cinfo) { + dev_err(dev, "no info for asoc-simple-card\n"); + return -EINVAL; + } - if (!cinfo) { - dev_err(dev, "no info for asoc-simple-card\n"); - return -EINVAL; + cinfo->snd_card.dev = &pdev->dev; } if (!cinfo->name ||