Skip to content

ASoC: SOF: ipc4-pcm: Move out be_rate initialization from for loop in…#5296

Merged
ranj063 merged 1 commit intothesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/ipc4-pcm-not-so-clever-analyzer-01
Jan 15, 2025
Merged

ASoC: SOF: ipc4-pcm: Move out be_rate initialization from for loop in…#5296
ranj063 merged 1 commit intothesofproject:topic/sof-devfrom
ujfalusi:peter/sof/pr/ipc4-pcm-not-so-clever-analyzer-01

Conversation

@ujfalusi
Copy link
Collaborator

… fixup

Instead of initializing the be_rate within the loop by checking i == 0 at each iteration, move the be_rate reference initialization from the loop. For BE single rate check we will have single comparison done at each iteration compared to two in case the num_input_formats were higher than 1.

We still need to run the loop from index 0 to check for FE-BE rate match.

The patch also fixes bogus reports from gcc static analyzer thinking that be_rate is used uninitialized later in the function (which was not true).

… fixup

Instead of initializing the be_rate within the loop by checking i == 0 at
each iteration, move the be_rate reference initialization from the loop.
For BE single rate check we will have single comparison done at each
iteration compared to two in case the num_input_formats were higher than 1.

We still need to run the loop from index 0 to check for FE-BE rate match.

The patch also fixes bogus reports from gcc static analyzer thinking that
be_rate is used uninitialized later in the function (which was not true).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
@ranj063 ranj063 merged commit b3b2051 into thesofproject:topic/sof-dev Jan 15, 2025
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants