diff options
| author | Xiubo Li <Li.Xiubo@freescale.com> | 2013-12-20 01:39:50 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@linaro.org> | 2013-12-21 09:42:48 -0500 |
| commit | dd41e0c4e35abc5a5679762ab108a6fcd9a0ead9 (patch) | |
| tree | 3aa43f149a98c663e0d5435a1276f213eb69db01 | |
| parent | fa558c2801fc173758c742d836f3cc4621851557 (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>
| -rw-r--r-- | sound/soc/generic/simple-card.c | 3 |
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, | |||
| 142 | if (ret < 0) | 142 | if (ret < 0) |
| 143 | return ret; | 143 | return ret; |
| 144 | 144 | ||
| 145 | if (!info->cpu_dai.name || !info->codec_dai.name) | ||
| 146 | return -EINVAL; | ||
| 147 | |||
| 145 | /* card name is created from CPU/CODEC dai name */ | 148 | /* card name is created from CPU/CODEC dai name */ |
| 146 | name = devm_kzalloc(dev, | 149 | name = devm_kzalloc(dev, |
| 147 | strlen(info->cpu_dai.name) + | 150 | strlen(info->cpu_dai.name) + |
