aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2014-12-24 07:56:32 -0500
committerMark Brown <broonie@kernel.org>2014-12-24 07:56:32 -0500
commitc533b8e60ab27e8f8782a1997f8417561140f7f8 (patch)
treedea6102659fad4fab860af7eb17ec9de67b605df /sound
parent97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff)
parente3b1e6a19e09877b91517dfe304a2b3f6b2138fc (diff)
Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 985052b3fbed..2c62620abca6 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3230,7 +3230,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3230 const char *propname) 3230 const char *propname)
3231{ 3231{
3232 struct device_node *np = card->dev->of_node; 3232 struct device_node *np = card->dev->of_node;
3233 int num_routes, old_routes; 3233 int num_routes;
3234 struct snd_soc_dapm_route *routes; 3234 struct snd_soc_dapm_route *routes;
3235 int i, ret; 3235 int i, ret;
3236 3236
@@ -3248,9 +3248,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3248 return -EINVAL; 3248 return -EINVAL;
3249 } 3249 }
3250 3250
3251 old_routes = card->num_dapm_routes; 3251 routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
3252 routes = devm_kzalloc(card->dev,
3253 (old_routes + num_routes) * sizeof(*routes),
3254 GFP_KERNEL); 3252 GFP_KERNEL);
3255 if (!routes) { 3253 if (!routes) {
3256 dev_err(card->dev, 3254 dev_err(card->dev,
@@ -3258,11 +3256,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3258 return -EINVAL; 3256 return -EINVAL;
3259 } 3257 }
3260 3258
3261 memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes));
3262
3263 for (i = 0; i < num_routes; i++) { 3259 for (i = 0; i < num_routes; i++) {
3264 ret = of_property_read_string_index(np, propname, 3260 ret = of_property_read_string_index(np, propname,
3265 2 * i, &routes[old_routes + i].sink); 3261 2 * i, &routes[i].sink);
3266 if (ret) { 3262 if (ret) {
3267 dev_err(card->dev, 3263 dev_err(card->dev,
3268 "ASoC: Property '%s' index %d could not be read: %d\n", 3264 "ASoC: Property '%s' index %d could not be read: %d\n",
@@ -3270,7 +3266,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3270 return -EINVAL; 3266 return -EINVAL;
3271 } 3267 }
3272 ret = of_property_read_string_index(np, propname, 3268 ret = of_property_read_string_index(np, propname,
3273 (2 * i) + 1, &routes[old_routes + i].source); 3269 (2 * i) + 1, &routes[i].source);
3274 if (ret) { 3270 if (ret) {
3275 dev_err(card->dev, 3271 dev_err(card->dev,
3276 "ASoC: Property '%s' index %d could not be read: %d\n", 3272 "ASoC: Property '%s' index %d could not be read: %d\n",
@@ -3279,7 +3275,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3279 } 3275 }
3280 } 3276 }
3281 3277
3282 card->num_dapm_routes += num_routes; 3278 card->num_dapm_routes = num_routes;
3283 card->dapm_routes = routes; 3279 card->dapm_routes = routes;
3284 3280
3285 return 0; 3281 return 0;