From 97ccf99b9b21e92fe59b1af1b25e4cbebbf7df5e Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Mon, 7 May 2018 11:19:24 -0700 Subject: [PATCH] ti_adc108s102: fix verification off-by-one Channel IDs start at 0, need to fail if the provided ID equals ADC108S102_CHANNELS, not just larger than it. Signed-off-by: Andrew Boie --- drivers/adc/adc_ti_adc108s102.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/adc/adc_ti_adc108s102.c b/drivers/adc/adc_ti_adc108s102.c index 17cbc1eefe2..7b86adbd000 100644 --- a/drivers/adc/adc_ti_adc108s102.c +++ b/drivers/adc/adc_ti_adc108s102.c @@ -138,7 +138,7 @@ static inline int _verify_entries(struct adc_seq_table *seq_table) entry = &seq_table->entries[i]; if (entry->sampling_delay <= 0 || - entry->channel_id > ADC108S102_CHANNELS) { + entry->channel_id >= ADC108S102_CHANNELS) { return 0; }