Hello Vijendar Mukunda,
Commit 6d8348ddc56e ("ASoC: amd: acp: refactor SoundWire machine
driver code") from Sep 13, 2024 (linux-next), leads to the following
Smatch static checker warning:
sound/soc/amd/acp/acp-sdw-sof-mach.c:365 sof_card_dai_links_create()
warn: inconsistent indenting
sound/soc/amd/acp/acp-sdw-sof-mach.c
307 static int sof_card_dai_links_create(struct snd_soc_card *card)
308 {
309 struct device *dev = card->dev;
310 struct snd_soc_acpi_mach *mach = dev_get_platdata(card->dev);
311 int sdw_be_num = 0, dmic_num = 0;
312 struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
313 struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params;
314 struct snd_soc_codec_conf *codec_conf;
315 struct asoc_sdw_endpoint *sof_ends;
316 struct asoc_sdw_dailink *sof_dais;
Just declare these as:
struct asoc_sdw_endpoint *sof_ends __free(kfree) = NULL;
struct asoc_sdw_dailink *sof_dais __free(kfree) = NULL;
Then you can delete all the gotos.
317 struct snd_soc_dai_link *dai_links;
318 int num_devs = 0;
319 int num_ends = 0;
320 int num_links;
321 int be_id = 0;
322 int ret;
323
324 ret = asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends);
325 if (ret < 0) {
326 dev_err(dev, "failed to count devices/endpoints: %d\n", ret);
327 return ret;
328 }
329
330 /* One per DAI link, worst case is a DAI link for every endpoint */
331 sof_dais = kcalloc(num_ends, sizeof(*sof_dais), GFP_KERNEL);
332 if (!sof_dais)
333 return -ENOMEM;
334
335 /* One per endpoint, ie. each DAI on each codec/amp */
336 sof_ends = kcalloc(num_ends, sizeof(*sof_ends), GFP_KERNEL);
337 if (!sof_ends) {
338 ret = -ENOMEM;
339 goto err_dai;
340 }
341
342 ret = asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs);
343 if (ret < 0)
344 goto err_end;
345
346 sdw_be_num = ret;
347
348 /* enable dmic */
349 if (sof_sdw_quirk & ASOC_SDW_ACP_DMIC || mach_params->dmic_num)
350 dmic_num = 1;
351
352 dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num);
353
354 codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL);
355 if (!codec_conf) {
356 ret = -ENOMEM;
357 goto err_end;
358 }
359
360 /* allocate BE dailinks */
361 num_links = sdw_be_num + dmic_num;
362 dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL);
363 if (!dai_links) {
364 ret = -ENOMEM;
--> 365 goto err_end;
Missing tab.
366 }
367
368 card->codec_conf = codec_conf;
369 card->num_configs = num_devs;
370 card->dai_link = dai_links;
371 card->num_links = num_links;
372
373 /* SDW */
374 if (sdw_be_num) {
375 ret = create_sdw_dailinks(card, &dai_links, &be_id,
376 sof_dais, &codec_conf);
377 if (ret)
378 goto err_end;
379 }
380
381 /* dmic */
382 if (dmic_num > 0) {
383 if (ctx->ignore_internal_dmic) {
384 dev_warn(dev, "Ignoring ACP DMIC\n");
385 } else {
386 ret = create_dmic_dailinks(card, &dai_links, &be_id);
387 if (ret)
388 goto err_end;
389 }
390 }
391
392 WARN_ON(codec_conf != card->codec_conf + card->num_configs);
393 WARN_ON(dai_links != card->dai_link + card->num_links);
394
395 err_end:
396 kfree(sof_ends);
397 err_dai:
398 kfree(sof_dais);
399
400 return ret;
401 }
regards,
dan carpenter
[Index of Archives]
[Pulseaudio]
[Linux Audio Users]
[ALSA Devel]
[Fedora Desktop]
[Fedora SELinux]
[Big List of Linux Books]
[Yosemite News]
[KDE Users]