linux-sound.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks()
@ 2025-05-06 12:07 Vijendar Mukunda
  2025-05-06 12:07 ` [PATCH 2/3] ASoC: amd: sof_amd_sdw: " Vijendar Mukunda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vijendar Mukunda @ 2025-05-06 12:07 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, lgirdwood, perex, tiwai, yung-chuan.liao,
	ranjani.sridharan, pierre-louis.bossart, Basavaraj.Hiregoudar,
	Sunil-kumar.Dommati, venkataprasad.potturu, Mario.Limonciello,
	linux-sound, linux-kernel, Vijendar Mukunda, stable

Initialize current_be_id to 0 in AMD legacy stack(NO DSP enabled) SoundWire
generic machine driver code to handle the unlikely case when there are no
devices connected to a DAI.

In this case create_sdw_dailink() would return without touching the passed
pointer to current_be_id.

Found by gcc -fanalyzer

Cc: stable@vger.kernel.org
Fixes: 2981d9b0789c4 ("ASoC: amd: acp: add soundwire machine driver for legacy stack")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
---
 sound/soc/amd/acp/acp-sdw-legacy-mach.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/amd/acp/acp-sdw-legacy-mach.c b/sound/soc/amd/acp/acp-sdw-legacy-mach.c
index 2020c5cfb3d5..582c68aee6e5 100644
--- a/sound/soc/amd/acp/acp-sdw-legacy-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-legacy-mach.c
@@ -272,7 +272,7 @@ static int create_sdw_dailinks(struct snd_soc_card *card,
 
 	/* generate DAI links by each sdw link */
 	while (soc_dais->initialised) {
-		int current_be_id;
+		int current_be_id = 0;
 
 		ret = create_sdw_dailink(card, soc_dais, dai_links,
 					 &current_be_id, codec_conf, sdw_platform_component);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] ASoC: amd: sof_amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks()
  2025-05-06 12:07 [PATCH 1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks() Vijendar Mukunda
@ 2025-05-06 12:07 ` Vijendar Mukunda
  2025-05-06 12:07 ` [PATCH 3/3] ASoC: amd: sof_amd_sdw: add logic to get cpu_pin_id for ACP7.0/ACP7.1 platforms Vijendar Mukunda
  2025-05-07  5:11 ` [PATCH 1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks() Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Vijendar Mukunda @ 2025-05-06 12:07 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, lgirdwood, perex, tiwai, yung-chuan.liao,
	ranjani.sridharan, pierre-louis.bossart, Basavaraj.Hiregoudar,
	Sunil-kumar.Dommati, venkataprasad.potturu, Mario.Limonciello,
	linux-sound, linux-kernel, Vijendar Mukunda, stable

Initialize current_be_id to 0 in SOF based AMD generic SoundWire machine
driver to handle the unlikely case when there are no devices connected to
a DAI.
In this case create_sdw_dailink() would return without touching the passed
pointer to current_be_id.

Found by gcc -fanalyzer

Cc: stable@vger.kernel.org
Fixes: 6d8348ddc56ed ("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 c09b1f118a6c..75bdd843ca36 100644
--- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
@@ -219,7 +219,7 @@ static int create_sdw_dailinks(struct snd_soc_card *card,
 
 	/* generate DAI links by each sdw link */
 	while (sof_dais->initialised) {
-		int current_be_id;
+		int current_be_id = 0;
 
 		ret = create_sdw_dailink(card, sof_dais, dai_links,
 					 &current_be_id, codec_conf);
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ASoC: amd: sof_amd_sdw: add logic to get cpu_pin_id for ACP7.0/ACP7.1 platforms
  2025-05-06 12:07 [PATCH 1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks() Vijendar Mukunda
  2025-05-06 12:07 ` [PATCH 2/3] ASoC: amd: sof_amd_sdw: " Vijendar Mukunda
@ 2025-05-06 12:07 ` Vijendar Mukunda
  2025-05-07  5:11 ` [PATCH 1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks() Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Vijendar Mukunda @ 2025-05-06 12:07 UTC (permalink / raw)
  To: broonie
  Cc: alsa-devel, lgirdwood, perex, tiwai, yung-chuan.liao,
	ranjani.sridharan, pierre-louis.bossart, Basavaraj.Hiregoudar,
	Sunil-kumar.Dommati, venkataprasad.potturu, Mario.Limonciello,
	linux-sound, linux-kernel, Vijendar Mukunda

Add logic to get cpu_pin_id for creating SoundWire dai link for
ACP7.0/ACP7.1 platforms.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
---
 sound/soc/amd/acp/acp-sdw-sof-mach.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c
index 75bdd843ca36..9e4a36d703ab 100644
--- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
@@ -128,6 +128,13 @@ static int create_sdw_dailink(struct snd_soc_card *card,
 			if (ret)
 				return ret;
 			break;
+		case ACP70_PCI_REV:
+		case ACP71_PCI_REV:
+			ret = get_acp70_cpu_pin_id(ffs(sof_end->link_mask - 1),
+						   *be_id, &cpu_pin_id, dev);
+			if (ret)
+				return ret;
+			break;
 		default:
 			return -EINVAL;
 		}
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks()
  2025-05-06 12:07 [PATCH 1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks() Vijendar Mukunda
  2025-05-06 12:07 ` [PATCH 2/3] ASoC: amd: sof_amd_sdw: " Vijendar Mukunda
  2025-05-06 12:07 ` [PATCH 3/3] ASoC: amd: sof_amd_sdw: add logic to get cpu_pin_id for ACP7.0/ACP7.1 platforms Vijendar Mukunda
@ 2025-05-07  5:11 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2025-05-07  5:11 UTC (permalink / raw)
  To: Vijendar Mukunda
  Cc: alsa-devel, lgirdwood, perex, tiwai, yung-chuan.liao,
	ranjani.sridharan, pierre-louis.bossart, Basavaraj.Hiregoudar,
	Sunil-kumar.Dommati, venkataprasad.potturu, Mario.Limonciello,
	linux-sound, linux-kernel, stable

On Tue, 06 May 2025 17:37:22 +0530, Vijendar Mukunda wrote:
> Initialize current_be_id to 0 in AMD legacy stack(NO DSP enabled) SoundWire
> generic machine driver code to handle the unlikely case when there are no
> devices connected to a DAI.
> 
> In this case create_sdw_dailink() would return without touching the passed
> pointer to current_be_id.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks()
      commit: 4d87ae7508cb7ff58fd0bcecc6e9491f42f987f8
[2/3] ASoC: amd: sof_amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks()
      commit: 6b83ba4bc3ecb915476d688c9f00f3be57b49a0c
[3/3] ASoC: amd: sof_amd_sdw: add logic to get cpu_pin_id for ACP7.0/ACP7.1 platforms
      commit: ad6d689e776478113aeef7bfb0e4222b1ff2a986

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-07  5:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06 12:07 [PATCH 1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks() Vijendar Mukunda
2025-05-06 12:07 ` [PATCH 2/3] ASoC: amd: sof_amd_sdw: " Vijendar Mukunda
2025-05-06 12:07 ` [PATCH 3/3] ASoC: amd: sof_amd_sdw: add logic to get cpu_pin_id for ACP7.0/ACP7.1 platforms Vijendar Mukunda
2025-05-07  5:11 ` [PATCH 1/3] ASoC: amd: amd_sdw: Fix unlikely uninitialized variable use in create_sdw_dailinks() Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).