summaryrefslogtreecommitdiff
path: root/sound/soc/generic
diff options
context:
space:
mode:
authorXiubo Li <Li.Xiubo@freescale.com>2013-12-20 14:39:50 +0800
committerMark Brown <broonie@linaro.org>2013-12-21 14:42:48 +0000
commitdd41e0c4e35abc5a5679762ab108a6fcd9a0ead9 (patch)
tree3aa43f149a98c663e0d5435a1276f213eb69db01 /sound/soc/generic
parentfa558c2801fc173758c742d836f3cc4621851557 (diff)
ASoC: simple-card: Add cpu_dai and codec_dai names NULL check
The name of cpu DAI maybe omitted, and then strlen() will lead kernel panic. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/generic')
-rw-r--r--sound/soc/generic/simple-card.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 7a9b6b4898c0..be7c1db5388f 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -142,6 +142,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
if (ret < 0)
return ret;
+ if (!info->cpu_dai.name || !info->codec_dai.name)
+ return -EINVAL;
+
/* card name is created from CPU/CODEC dai name */
name = devm_kzalloc(dev,
strlen(info->cpu_dai.name) +