diff options
-rw-r--r-- | drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c index a2014375587d..b460b56e981c 100644 --- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c +++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c @@ -375,13 +375,6 @@ static int adc_tm5_init(struct adc_tm5_chip *chip) int ret; unsigned int i; - for (i = 0; i < chip->nchannels; i++) { - if (chip->channels[i].channel >= channels_available) { - dev_err(chip->dev, "Invalid channel %d\n", chip->channels[i].channel); - return -EINVAL; - } - } - ret = adc_tm5_read(chip, ADC_TM5_NUM_BTM, &channels_available, sizeof(channels_available)); if (ret) { @@ -389,6 +382,13 @@ static int adc_tm5_init(struct adc_tm5_chip *chip) return ret; } + for (i = 0; i < chip->nchannels; i++) { + if (chip->channels[i].channel >= channels_available) { + dev_err(chip->dev, "Invalid channel %d\n", chip->channels[i].channel); + return -EINVAL; + } + } + buf[0] = chip->decimation; buf[1] = chip->avg_samples | ADC_TM5_FAST_AVG_EN; buf[2] = ADC_TM5_TIMER1; |