ASoC: SOF: ipc4-pcm: Move out be_rate initialization from for loop in fixup
Subsystems (3)
Peter Ujfalusi
maintainerPATCH 1/1 ASoC: SOF: ipc4-pcm: Move out be_rate initialization from for loop in 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).
--- sound/soc/sof/ipc4-pcm.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
sound/soc/sof/ipc4-pcm.c +2 -3
@@ -610,12 +610,11 @@ static int sof_ipc4_pcm_dai_link_fixup_rate(struct snd_sof_dev *sdev,* Copier does not change sampling rate, so we * need to only consider the input pin information. */ + be_rate = pin_fmts[0 ].audio_fmt.sampling_frequency;for (i =0 ; i < num_input_formats; i++) {unsigned int val = pin_fmts[i].audio_fmt.sampling_frequency; -if (i ==0 ) - be_rate = val; -else if (val != be_rate) +if (val != be_rate) single_be_rate = false;if (val == fe_rate) {
Signature · 1 line
2.48.1
Mark Brown
maintainerQuoted 8 lines · Peter Ujfalusi
Instead of initializing the
be_ratewithin the loop by checking i == 0 at each iteration, move thebe_ratereference initialization from the loop. For BE single rate check we will have single comparison done at each iteration compared to two in case thenum_input_formatswere higher than 1.We still need to run the loop from index 0 to check for FE-BE rate match.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: SOF: ipc4-pcm: Move out be_rate initialization from for loop in fixup
commit: 5ea46b4360791345bd0bf4c7bf8fff5151374ea1
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