ASoC: codecs: lpass-va-macro: remove some dead code
Subsystems (4)
PATCH 1/1 ASoC: codecs: lpass-va-macro: remove some dead code
The "decimator" variable is in the 0-7 range and it's unsigned so there is no need to check for negative values.
--- sound/soc/codecs/lpass-va-macro.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)
sound/soc/codecs/lpass-va-macro.c +4 -11
@@ -844,17 +844,10 @@ static int va_macro_hw_params(struct snd_pcm_substream *substream,for_each_set_bit (decimator, &va->active_ch_mask[dai->id],VA_MACRO_DEC_MAX ) { -if (decimator >=0 ) { - tx_fs_reg =CDC_VA_TX0_TX_PATH_CTL + -VA_MACRO_TX_PATH_OFFSET * decimator; -snd_soc_component_update_bits (component, tx_fs_reg, -0x0F , tx_fs_rate); - }else { -dev_err (va_dev, -"%s: ERROR: Invalid decimator: %d\n" , - __func__, decimator); -return -EINVAL ; - } + tx_fs_reg =CDC_VA_TX0_TX_PATH_CTL + +VA_MACRO_TX_PATH_OFFSET * decimator; +snd_soc_component_update_bits (component, tx_fs_reg,0x0F , + tx_fs_rate); }return 0 ; }
Signature · 1 line
2.29.2
Thanks Dan for the patch!
Do you use any tools to do this checks?
Quoted 5 lines · Dan Carpenter
The "decimator" variable is in the 0-7 range and it's unsigned so there is no need to check for negative values.
Fixes 908e6b1df26e ("ASoC: codecs: lpass-va-macro: Add support to VA Macro")Signed-off-by Dan Carpenter <[email protected]>
Quoted 31 lines
--- sound/soc/codecs/lpass-va-macro.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-)sound/soc/codecs/lpass-va-macro.c +4
-11@@ -844,17 +844,10 @@ static int va_macro_hw_params(struct snd_pcm_substream *substream,for_each_set_bit (decimator, &va->active_ch_mask[dai->id],VA_MACRO_DEC_MAX ) { -if (decimator >=0 ) { - tx_fs_reg =CDC_VA_TX0_TX_PATH_CTL + -VA_MACRO_TX_PATH_OFFSET * decimator; -snd_soc_component_update_bits (component, tx_fs_reg, -0x0F , tx_fs_rate); - }else { -dev_err (va_dev, -"%s: ERROR: Invalid decimator: %d\n" , - __func__, decimator); -return -EINVAL ; - } + tx_fs_reg =CDC_VA_TX0_TX_PATH_CTL + +VA_MACRO_TX_PATH_OFFSET * decimator; +snd_soc_component_update_bits (component, tx_fs_reg,0x0F , + tx_fs_rate); }return 0 ; }
Quoted 4 lines · Srinivas Kandagatla
Thanks Dan for the patch!
Do you use any tools to do this checks?
Yeah. This was a Smatch warning:
sound/soc/codecs/lpass-va-macro.c:847 va_macro_hw_params() warn: always true condition '(decimator >= 0) => (0-u32max >= 0)'
But every static checker will complain about these.
regards,
dan carpenter
Mark Brown
maintainerQuoted 2 lines · Dan Carpenter
The "decimator" variable is in the 0-7 range and it's unsigned so there is no need to check for negative values.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: codecs: lpass-va-macro: remove some dead code
commit: 4d638b9cc79eff11bad13fb3715c0ef38a9edaec
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