Commit 850ba84b authored by Dan Murphy's avatar Dan Murphy Committed by Mark Brown

ASoC: tlv320adcx140: Fix warnings when using W=1

Fix the warnings when using the W=1 compiler flag.

sound/soc/codecs/tlv320adcx140.c: In function ‘adcx140_reset’:
sound/soc/codecs/tlv320adcx140.c:570:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
  570 |  int ret = 0;
      |      ^~~

This was set but only used in case where the reset GPIO is not defined.
Have the function return the value of ret.

sound/soc/codecs/tlv320adcx140.c: In function ‘adcx140_codec_probe’:
sound/soc/codecs/tlv320adcx140.c:778:18: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
  778 |  if (bias_source < ADCX140_MIC_BIAS_VAL_VREF ||
      |                  ^
sound/soc/codecs/tlv320adcx140.c:789:18: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
  789 |  if (vref_source < ADCX140_MIC_BIAS_VREF_275V ||

This condition will not occur since if the dt property is not set then
the *_source variable is set to the default value.  So there is no way
that *_source can be less then 0.  Which is what each #define is set to.
The code just needs to make sure that the dt property is not out of the
upper bounds.
Reported-by: default avatarkbuild test robot <lkp@intel.com>
Signed-off-by: default avatarDan Murphy <dmurphy@ti.com>
Link: https://lore.kernel.org/r/20200526175247.15309-1-dmurphy@ti.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 920bef64
...@@ -582,7 +582,7 @@ static int adcx140_reset(struct adcx140_priv *adcx140) ...@@ -582,7 +582,7 @@ static int adcx140_reset(struct adcx140_priv *adcx140)
/* 8.4.2: wait >= 10 ms after entering sleep mode. */ /* 8.4.2: wait >= 10 ms after entering sleep mode. */
usleep_range(10000, 100000); usleep_range(10000, 100000);
return 0; return ret;
} }
static int adcx140_hw_params(struct snd_pcm_substream *substream, static int adcx140_hw_params(struct snd_pcm_substream *substream,
...@@ -775,8 +775,7 @@ static int adcx140_codec_probe(struct snd_soc_component *component) ...@@ -775,8 +775,7 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
if (ret) if (ret)
bias_source = ADCX140_MIC_BIAS_VAL_VREF; bias_source = ADCX140_MIC_BIAS_VAL_VREF;
if (bias_source < ADCX140_MIC_BIAS_VAL_VREF || if (bias_source > ADCX140_MIC_BIAS_VAL_AVDD) {
bias_source > ADCX140_MIC_BIAS_VAL_AVDD) {
dev_err(adcx140->dev, "Mic Bias source value is invalid\n"); dev_err(adcx140->dev, "Mic Bias source value is invalid\n");
return -EINVAL; return -EINVAL;
} }
...@@ -786,8 +785,7 @@ static int adcx140_codec_probe(struct snd_soc_component *component) ...@@ -786,8 +785,7 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
if (ret) if (ret)
vref_source = ADCX140_MIC_BIAS_VREF_275V; vref_source = ADCX140_MIC_BIAS_VREF_275V;
if (vref_source < ADCX140_MIC_BIAS_VREF_275V || if (vref_source > ADCX140_MIC_BIAS_VREF_1375V) {
vref_source > ADCX140_MIC_BIAS_VREF_1375V) {
dev_err(adcx140->dev, "Mic Bias source value is invalid\n"); dev_err(adcx140->dev, "Mic Bias source value is invalid\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment