@@ -3230,7 +3230,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3230
3230
const char * propname )
3231
3231
{
3232
3232
struct device_node * np = card -> dev -> of_node ;
3233
- int num_routes , old_routes ;
3233
+ int num_routes ;
3234
3234
struct snd_soc_dapm_route * routes ;
3235
3235
int i , ret ;
3236
3236
@@ -3248,29 +3248,25 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3248
3248
return - EINVAL ;
3249
3249
}
3250
3250
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 ),
3254
3252
GFP_KERNEL );
3255
3253
if (!routes ) {
3256
3254
dev_err (card -> dev ,
3257
3255
"ASoC: Could not allocate DAPM route table\n" );
3258
3256
return - EINVAL ;
3259
3257
}
3260
3258
3261
- memcpy (routes , card -> dapm_routes , old_routes * sizeof (* routes ));
3262
-
3263
3259
for (i = 0 ; i < num_routes ; i ++ ) {
3264
3260
ret = of_property_read_string_index (np , propname ,
3265
- 2 * i , & routes [old_routes + i ].sink );
3261
+ 2 * i , & routes [i ].sink );
3266
3262
if (ret ) {
3267
3263
dev_err (card -> dev ,
3268
3264
"ASoC: Property '%s' index %d could not be read: %d\n" ,
3269
3265
propname , 2 * i , ret );
3270
3266
return - EINVAL ;
3271
3267
}
3272
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
3270
if (ret ) {
3275
3271
dev_err (card -> dev ,
3276
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
3279
card -> dapm_routes = routes ;
3284
3280
3285
3281
return 0 ;
0 commit comments