Skip to content

Commit

Permalink
ASoC: Intel: sof_sdw: Fix unlikely uninitialized variable use in crea…
Browse files Browse the repository at this point in the history
…te_sdw_dailinks()

Initialize current_be_id to 0 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

Fixes: 59bf457 ("ASoC: intel: sof_sdw: Factor out SoundWire DAI creation")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://patch.msgid.link/20250303065552.78328-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Peter Ujfalusi authored and Mark Brown committed Mar 3, 2025
1 parent 7eb1721 commit 4363f02
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/soc/intel/boards/sof_sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,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);
Expand Down

0 comments on commit 4363f02

Please sign in to comment.