1 From 6b83ba4bc3ecb915476d688c9f00f3be57b49a0c Mon Sep 17 00:00:00 2001
2 From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
3 Date: Tue, 6 May 2025 17:37:23 +0530
4 Subject: ASoC: amd: sof_amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks()
6 From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
8 commit 6b83ba4bc3ecb915476d688c9f00f3be57b49a0c upstream.
10 Initialize current_be_id to 0 in SOF based AMD generic SoundWire machine
11 driver to handle the unlikely case when there are no devices connected to
13 In this case create_sdw_dailink() would return without touching the passed
14 pointer to current_be_id.
16 Found by gcc -fanalyzer
18 Cc: stable@vger.kernel.org
19 Fixes: 6d8348ddc56ed ("ASoC: amd: acp: refactor SoundWire machine driver code")
20 Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
21 Link: https://patch.msgid.link/20250506120823.3621604-2-Vijendar.Mukunda@amd.com
22 Signed-off-by: Mark Brown <broonie@kernel.org>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25 sound/soc/amd/acp/acp-sdw-sof-mach.c | 2 +-
26 1 file changed, 1 insertion(+), 1 deletion(-)
28 --- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
29 +++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
30 @@ -267,7 +267,7 @@ static int create_sdw_dailinks(struct sn
32 /* generate DAI links by each sdw link */
33 while (sof_dais->initialised) {
35 + int current_be_id = 0;
37 ret = create_sdw_dailink(card, sof_dais, dai_links,
38 ¤t_be_id, codec_conf);