ASoC: core: check of_property_count_strings failure
authorRichard Zhao <richard.zhao@freescale.com>
Tue, 24 Apr 2012 07:24:43 +0000 (15:24 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 24 Apr 2012 11:06:27 +0000 (12:06 +0100)
Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
sound/soc/soc-core.c

index 3a4e93e52b6d95a237fe711b7dccf64c58dbfd62..b390f00b4e9946a1b3526048de0e608035ff569f 100644 (file)
@@ -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;