Skip to content

Commit c533b8e

Browse files
committed
Merge remote-tracking branch 'asoc/fix/dapm' into asoc-linus
2 parents 97bf6af + e3b1e6a commit c533b8e

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

sound/soc/soc-core.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3230,7 +3230,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
32303230
const char *propname)
32313231
{
32323232
struct device_node *np = card->dev->of_node;
3233-
int num_routes, old_routes;
3233+
int num_routes;
32343234
struct snd_soc_dapm_route *routes;
32353235
int i, ret;
32363236

@@ -3248,29 +3248,25 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
32483248
return -EINVAL;
32493249
}
32503250

3251-
old_routes = card->num_dapm_routes;
3252-
routes = devm_kzalloc(card->dev,
3253-
(old_routes + num_routes) * sizeof(*routes),
3251+
routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
32543252
GFP_KERNEL);
32553253
if (!routes) {
32563254
dev_err(card->dev,
32573255
"ASoC: Could not allocate DAPM route table\n");
32583256
return -EINVAL;
32593257
}
32603258

3261-
memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes));
3262-
32633259
for (i = 0; i < num_routes; i++) {
32643260
ret = of_property_read_string_index(np, propname,
3265-
2 * i, &routes[old_routes + i].sink);
3261+
2 * i, &routes[i].sink);
32663262
if (ret) {
32673263
dev_err(card->dev,
32683264
"ASoC: Property '%s' index %d could not be read: %d\n",
32693265
propname, 2 * i, ret);
32703266
return -EINVAL;
32713267
}
32723268
ret = of_property_read_string_index(np, propname,
3273-
(2 * i) + 1, &routes[old_routes + i].source);
3269+
(2 * i) + 1, &routes[i].source);
32743270
if (ret) {
32753271
dev_err(card->dev,
32763272
"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,
32793275
}
32803276
}
32813277

3282-
card->num_dapm_routes += num_routes;
3278+
card->num_dapm_routes = num_routes;
32833279
card->dapm_routes = routes;
32843280

32853281
return 0;

0 commit comments

Comments
 (0)