]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ASoC: fsl: fsl_ssi: remove unnecessary tests
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 19 Feb 2021 23:29:33 +0000 (17:29 -0600)
committerMark Brown <broonie@kernel.org>
Wed, 10 Mar 2021 13:06:39 +0000 (13:06 +0000)
cppcheck warnings:

sound/soc/fsl/fsl_ssi.c:767:34: style: Condition 'div2' is always
false [knownConditionTrueFalse]
 stccr = SSI_SxCCR_PM(pm + 1) | (div2 ? SSI_SxCCR_DIV2 : 0) |
                                 ^
sound/soc/fsl/fsl_ssi.c:722:9: note: Assignment 'div2=0', assigned value is 0
 div2 = 0;
        ^
sound/soc/fsl/fsl_ssi.c:767:34: note: Condition 'div2' is always false
 stccr = SSI_SxCCR_PM(pm + 1) | (div2 ? SSI_SxCCR_DIV2 : 0) |
                                 ^
sound/soc/fsl/fsl_ssi.c:768:4: style: Condition 'psr' is always false
[knownConditionTrueFalse]
  (psr ? SSI_SxCCR_PSR : 0);
   ^
sound/soc/fsl/fsl_ssi.c:721:8: note: Assignment 'psr=0', assigned
value is 0
 psr = 0;
       ^
sound/soc/fsl/fsl_ssi.c:768:4: note: Condition 'psr' is always false
  (psr ? SSI_SxCCR_PSR : 0);
   ^

Upon further analysis, the variables 'div2' and 'psr' are set to zero
and never modified. All the tests can be removed.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210219232937.6440-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_ssi.c

index ad8af3f450e29d9cd3e1dd14ff4f4235b61dd7e0..4e2ce47a7c6e7d2e73a2942d849562720a5c317a 100644 (file)
@@ -747,7 +747,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
                sub *= 100000;
                do_div(sub, freq);
 
-               if (sub < savesub && !(i == 0 && psr == 0 && div2 == 0)) {
+               if (sub < savesub && !(i == 0)) {
                        baudrate = tmprate;
                        savesub = sub;
                        pm = i;
@@ -764,8 +764,7 @@ static int fsl_ssi_set_bclk(struct snd_pcm_substream *substream,
                return -EINVAL;
        }
 
-       stccr = SSI_SxCCR_PM(pm + 1) | (div2 ? SSI_SxCCR_DIV2 : 0) |
-               (psr ? SSI_SxCCR_PSR : 0);
+       stccr = SSI_SxCCR_PM(pm + 1);
        mask = SSI_SxCCR_PM_MASK | SSI_SxCCR_DIV2 | SSI_SxCCR_PSR;
 
        /* STCCR is used for RX in synchronous mode */