From: Richard Zhao <richard.zhao@freescale.com>
Date: Tue, 24 Apr 2012 07:24:43 +0000 (+0800)
Subject: ASoC: core: check of_property_count_strings failure
X-Git-Tag: v3.4-rc6~6^2~1^2~4
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c34ce320d9fe328e3272def20b152f39ccfa045e;p=linux.git
ASoC: core: check of_property_count_strings failure
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
---
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3a4e93e52b6d..b390f00b4e99 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3631,10 +3631,10 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
int i, ret;
num_routes = of_property_count_strings(np, propname);
- if (num_routes & 1) {
+ if (num_routes < 0 || num_routes & 1) {
dev_err(card->dev,
- "Property '%s's length is not even\n",
- propname);
+ "Property '%s' does not exist or its length is not even\n",
+ propname);
return -EINVAL;
}
num_routes /= 2;