summaryrefslogtreecommitdiff
path: root/sound/soc
diff options
context:
space:
mode:
authorDan Murphy <dmurphy@ti.com>2020-03-04 22:34:27 +0300
committerMark Brown <broonie@kernel.org>2020-03-05 16:15:16 +0300
commit2e4249f58074ec93746df3a902d1835b7edfef49 (patch)
tree05fb650369ff8c1fcd301560f16afbf4ded2ca0e /sound/soc
parentcc6eb9b512c8411e3fa42417d9eefa1c1a86caa3 (diff)
downloadlinux-2e4249f58074ec93746df3a902d1835b7edfef49.tar.xz
ASoC: tlv320adcx140: Fix mic_bias and vref device tree verification
Fix the range verification check for the mic_bias and vref device tree entries. Fixes 37bde5acf040 ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec driver family") Signed-off-by: Dan Murphy <dmurphy@ti.com> Link: https://lore.kernel.org/r/20200304193427.16886-1-dmurphy@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/tlv320adcx140.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index 93a0cb8e662c..38897568ee96 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -748,9 +748,8 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
if (ret)
bias_source = ADCX140_MIC_BIAS_VAL_VREF;
- if (bias_source != ADCX140_MIC_BIAS_VAL_VREF &&
- bias_source != ADCX140_MIC_BIAS_VAL_VREF_1096 &&
- bias_source != ADCX140_MIC_BIAS_VAL_AVDD) {
+ if (bias_source < ADCX140_MIC_BIAS_VAL_VREF ||
+ bias_source > ADCX140_MIC_BIAS_VAL_AVDD) {
dev_err(adcx140->dev, "Mic Bias source value is invalid\n");
return -EINVAL;
}
@@ -760,9 +759,8 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
if (ret)
vref_source = ADCX140_MIC_BIAS_VREF_275V;
- if (vref_source != ADCX140_MIC_BIAS_VREF_275V &&
- vref_source != ADCX140_MIC_BIAS_VREF_25V &&
- vref_source != ADCX140_MIC_BIAS_VREF_1375V) {
+ if (vref_source < ADCX140_MIC_BIAS_VREF_275V ||
+ vref_source > ADCX140_MIC_BIAS_VREF_1375V) {
dev_err(adcx140->dev, "Mic Bias source value is invalid\n");
return -EINVAL;
}