lkml.org 
[lkml]   [2020]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH for-next] ASoC: tlv320adcx140: Fix mic_bias and vref device tree verification
Date
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>
---
sound/soc/codecs/tlv320adcx140.c | 10 ++++------
1 file 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;
}
--
2.25.1
\
 
 \ /
  Last update: 2020-03-04 20:41    [W:0.150 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site