[PATCH 0/3] Fixes and improvements related to amd soundwire machine
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(-)
Fix below Smatch static checker warning:
sound/soc/amd/acp/acp-sdw-sof-mach.c:365 sof_card_dai_links_create() warn: inconsistent indenting
Reported-by: Dan Carpenter dan.carpenter@linaro.org Closes: https://lore.kernel.org/all/a201e871-375e-43eb-960d-5c048956c2ff@amd.com/T/ Fixes: 6d8348ddc56e ("ASoC: amd: acp: refactor SoundWire machine driver code") Signed-off-by: Vijendar Mukunda Vijendar.Mukunda@amd.com --- sound/soc/amd/acp/acp-sdw-sof-mach.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c index 306854fb08e3..acab2675d1f5 100644 --- a/sound/soc/amd/acp/acp-sdw-sof-mach.c +++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c @@ -362,7 +362,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL); if (!dai_links) { ret = -ENOMEM; - goto err_end; + goto err_end; }
card->codec_conf = codec_conf;
Multi link aggregation is not supported for acp6.3 platform. Below combinations are supported. - one sdw BE DAI <---> one-cpu DAI <---> one-codec DAI - one sdw BE DAI <---> one-cpu DAI <---> multi-codec DAIs As Single cpu dai is going to be created, In create_sdw_dailink() function cpu dai index won't be incremented. Refactor cpu dai index logic to fix below smatch static checker warning. sound/soc/amd/acp/acp-sdw-sof-mach.c:157 create_sdw_dailink() warn: iterator 'i' not incremented.
Reported-by: Dan Carpenter dan.carpenter@linaro.org Closes: https://lore.kernel.org/all/a201e871-375e-43eb-960d-5c048956c2ff@amd.com/T/ Fixes: 6d8348ddc56e ("ASoC: amd: acp: refactor SoundWire machine driver code") Signed-off-by: Vijendar Mukunda Vijendar.Mukunda@amd.com --- sound/soc/amd/acp/acp-sdw-sof-mach.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c index acab2675d1f5..3be401c72270 100644 --- a/sound/soc/amd/acp/acp-sdw-sof-mach.c +++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c @@ -154,7 +154,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int num_cpus = hweight32(sof_dai->link_mask[stream]); int num_codecs = sof_dai->num_devs[stream]; int playback, capture; - int i = 0, j = 0; + int j = 0; char *name;
if (!sof_dai->num_devs[stream]) @@ -213,14 +213,14 @@ static int create_sdw_dailink(struct snd_soc_card *card,
int link_num = ffs(sof_end->link_mask) - 1;
- cpus[i].dai_name = devm_kasprintf(dev, GFP_KERNEL, - "SDW%d Pin%d", - link_num, cpu_pin_id); - dev_dbg(dev, "cpu[%d].dai_name:%s\n", i, cpus[i].dai_name); - if (!cpus[i].dai_name) + cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, + "SDW%d Pin%d", + link_num, cpu_pin_id); + dev_dbg(dev, "cpu->dai_name:%s\n", cpus->dai_name); + if (!cpus->dai_name) return -ENOMEM;
- codec_maps[j].cpu = i; + codec_maps[j].cpu = 0; codec_maps[j].codec = j;
codecs[j].name = sof_end->codec_name;
Refactor sof_card_dai_links_create() function by replacing 'sof_ends' and 'sof_dais' structure declarations as struct asoc_sdw_endpoint *sof_ends __free(kfree) = NULL; struct asoc_sdw_dailink *sof_dais __free(kfree) = NULL; Use above declarations to eliminate goto statements usage.
Suggested-by: Dan Carpenter dan.carpenter@linaro.org Signed-off-by: Vijendar Mukunda Vijendar.Mukunda@amd.com --- sound/soc/amd/acp/acp-sdw-sof-mach.c | 33 ++++++++++------------------ 1 file changed, 11 insertions(+), 22 deletions(-)
diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c index 3be401c72270..36e6d6db90c1 100644 --- a/sound/soc/amd/acp/acp-sdw-sof-mach.c +++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c @@ -311,9 +311,9 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) int sdw_be_num = 0, dmic_num = 0; struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card); struct snd_soc_acpi_mach_params *mach_params = &mach->mach_params; + struct asoc_sdw_endpoint *sof_ends __free(kfree) = NULL; + struct asoc_sdw_dailink *sof_dais __free(kfree) = NULL; struct snd_soc_codec_conf *codec_conf; - struct asoc_sdw_endpoint *sof_ends; - struct asoc_sdw_dailink *sof_dais; struct snd_soc_dai_link *dai_links; int num_devs = 0; int num_ends = 0; @@ -334,14 +334,12 @@ static int sof_card_dai_links_create(struct snd_soc_card *card)
/* One per endpoint, ie. each DAI on each codec/amp */ sof_ends = kcalloc(num_ends, sizeof(*sof_ends), GFP_KERNEL); - if (!sof_ends) { - ret = -ENOMEM; - goto err_dai; - } + if (!sof_ends) + return -ENOMEM;
ret = asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs); if (ret < 0) - goto err_end; + return ret;
sdw_be_num = ret;
@@ -352,18 +350,14 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num);
codec_conf = devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNEL); - if (!codec_conf) { - ret = -ENOMEM; - goto err_end; - } + if (!codec_conf) + return -ENOMEM;
/* allocate BE dailinks */ num_links = sdw_be_num + dmic_num; dai_links = devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL); - if (!dai_links) { - ret = -ENOMEM; - goto err_end; - } + if (!dai_links) + return -ENOMEM;
card->codec_conf = codec_conf; card->num_configs = num_devs; @@ -375,7 +369,7 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) ret = create_sdw_dailinks(card, &dai_links, &be_id, sof_dais, &codec_conf); if (ret) - goto err_end; + return ret; }
/* dmic */ @@ -385,18 +379,13 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) } else { ret = create_dmic_dailinks(card, &dai_links, &be_id); if (ret) - goto err_end; + return ret; } }
WARN_ON(codec_conf != card->codec_conf + card->num_configs); WARN_ON(dai_links != card->dai_link + card->num_links);
-err_end: - kfree(sof_ends); -err_dai: - kfree(sof_dais); - return ret; }
On Mon, 07 Oct 2024 14:23:18 +0530, Vijendar Mukunda wrote:
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
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: amd: acp: fix for inconsistent indenting commit: 914219d74931211e719907e0eed03d8133f8b1b7 [2/3] ASoC: amd: acp: fix for cpu dai index logic commit: 7ce8e4d380d68f34edc96c7efcf95b1476e7f033 [3/3] ASoC: amd: acp: refactor sof_card_dai_links_create() function commit: 0372abfcd81a4db94070d235e1ae3ff928efcab9
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
participants (2)
-
Mark Brown
-
Vijendar Mukunda