ASoC: codecs: aw88261: small cleanup in aw88261_set_tdm_slot()
Subsystems (3)
PATCH 1/1 ASoC: codecs: aw88261: small cleanup in aw88261_set_tdm_slot()
This code triggers a Smatch false positive:
sound/soc/codecs/aw88261.c:858 aw88261_set_tdm_slot()
error: uninitialized symbol 'chan'.
This would only happen if both the tx and rx masks were zero which is a nonsense scenario and reviewing the callers shows that it never happens.
However, if the rx_mask is zero then we're comparing the mask from RX against the chan from TX which is confusing:
if ((rx_mask & ~BIT(chan)) != 0) {
^^ rx ^^^^ tx chanOf course, in that case the condition is going to be false because the rx_mask is zero. So it's fine. But it would be more clear to move the condition inside the if statement and it silences the static checker warning as well.
---
From code review. Untested.
sound/soc/codecs/aw88261.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/codecs/aw88261.c +5 -5
@@ -853,13 +853,13 @@ static int aw88261_set_tdm_slot(struct snd_soc_dai *dai,return -EINVAL ; aw88261->rxl_slotvld_mask = chan <<AW88261_I2S_RXL_SLOTVLD_START_BIT ; - } -if ((rx_mask & ~BIT (chan)) !=0 ) { -if ((chan =__ffs (rx_mask & ~BIT (chan))) >16 ) -return -EINVAL ; +if ((rx_mask & ~BIT (chan)) !=0 ) { +if ((chan =__ffs (rx_mask & ~BIT (chan))) >16 ) +return -EINVAL ; - aw88261->rxr_slotvld_mask = chan <<AW88261_I2S_RXR_SLOTVLD_START_BIT ; + aw88261->rxr_slotvld_mask = chan <<AW88261_I2S_RXR_SLOTVLD_START_BIT ; + } }return 0 ;
Signature · 1 line
2.53.0
Mark Brown
maintainerQuoted 1 line · Dan Carpenter
ASoC: codecs: aw88261: small cleanup in
aw88261_set_tdm_slot()
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
Thanks!
[1/1] ASoC: codecs: aw88261: small cleanup in aw88261_set_tdm_slot()
https://git.kernel.org/broonie/sound/c/015f14e42b22
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