Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fixes and improvements related to amd soundwire

Merge series from Vijendar Mukunda <Vijendar.Mukunda@amd.com>:

This patch series consists of smatch error fixes and code improvements
related to amd soundwire generic machine driver.

Vijendar Mukunda (3):
ASoC: amd: acp: fix for inconsistent indenting
ASoC: amd: acp: fix for cpu dai index logic
ASoC: amd: acp: refactor sof_card_dai_links_create() function

sound/soc/amd/acp/acp-sdw-sof-mach.c | 47 +++++++++++-----------------
1 file changed, 18 insertions(+), 29 deletions(-)

--
2.34.1

+18 -29
+18 -29
sound/soc/amd/acp/acp-sdw-sof-mach.c
··· 154 154 int num_cpus = hweight32(sof_dai->link_mask[stream]); 155 155 int num_codecs = sof_dai->num_devs[stream]; 156 156 int playback, capture; 157 - int i = 0, j = 0; 157 + int j = 0; 158 158 char *name; 159 159 160 160 if (!sof_dai->num_devs[stream]) ··· 213 213 214 214 int link_num = ffs(sof_end->link_mask) - 1; 215 215 216 - cpus[i].dai_name = devm_kasprintf(dev, GFP_KERNEL, 217 - "SDW%d Pin%d", 218 - link_num, cpu_pin_id); 219 - dev_dbg(dev, "cpu[%d].dai_name:%s\n", i, cpus[i].dai_name); 220 - if (!cpus[i].dai_name) 216 + cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, 217 + "SDW%d Pin%d", 218 + link_num, cpu_pin_id); 219 + dev_dbg(dev, "cpu->dai_name:%s\n", cpus->dai_name); 220 + if (!cpus->dai_name) 221 221 return -ENOMEM; 222 222 223 - codec_maps[j].cpu = i; 223 + codec_maps[j].cpu = 0; 224 224 codec_maps[j].codec = j; 225 225 226 226 codecs[j].name = sof_end->codec_name; ··· 311 311 int sdw_be_num = 0, dmic_num = 0; 312 312 struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card); 313 313 struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; 314 + struct asoc_sdw_endpoint *sof_ends __free(kfree) = NULL; 315 + struct asoc_sdw_dailink *sof_dais __free(kfree) = NULL; 314 316 struct snd_soc_codec_conf *codec_conf; 315 - struct asoc_sdw_endpoint *sof_ends; 316 - struct asoc_sdw_dailink *sof_dais; 317 317 struct snd_soc_dai_link *dai_links; 318 318 int num_devs = 0; 319 319 int num_ends = 0; ··· 334 334 335 335 /* One per endpoint, ie. each DAI on each codec/amp */ 336 336 sof_ends = kcalloc(num_ends, sizeof(*sof_ends), GFP_KERNEL); 337 - if (!sof_ends) { 338 - ret = -ENOMEM; 339 - goto err_dai; 340 - } 337 + if (!sof_ends) 338 + return -ENOMEM; 341 339 342 340 ret = asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs); 343 341 if (ret < 0) 344 - goto err_end; 342 + return ret; 345 343 346 344 sdw_be_num = ret; 347 345 ··· 350 352 dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num); 351 353 352 354 codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL); 353 - if (!codec_conf) { 354 - ret = -ENOMEM; 355 - goto err_end; 356 - } 355 + if (!codec_conf) 356 + return -ENOMEM; 357 357 358 358 /* allocate BE dailinks */ 359 359 num_links = sdw_be_num + dmic_num; 360 360 dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL); 361 - if (!dai_links) { 362 - ret = -ENOMEM; 363 - goto err_end; 364 - } 361 + if (!dai_links) 362 + return -ENOMEM; 365 363 366 364 card->codec_conf = codec_conf; 367 365 card->num_configs = num_devs; ··· 369 375 ret = create_sdw_dailinks(card, &dai_links, &be_id, 370 376 sof_dais, &codec_conf); 371 377 if (ret) 372 - goto err_end; 378 + return ret; 373 379 } 374 380 375 381 /* dmic */ ··· 379 385 } else { 380 386 ret = create_dmic_dailinks(card, &dai_links, &be_id); 381 387 if (ret) 382 - goto err_end; 388 + return ret; 383 389 } 384 390 } 385 391 386 392 WARN_ON(codec_conf != card->codec_conf + card->num_configs); 387 393 WARN_ON(dai_links != card->dai_link + card->num_links); 388 - 389 - err_end: 390 - kfree(sof_ends); 391 - err_dai: 392 - kfree(sof_dais); 393 394 394 395 return ret; 395 396 }