mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
adc: fix out of bound read
when SOC_ADC_PERIPH_NUM==1, the adc_unit should only be assigned with 0
This commit is contained in:
parent
f9cf8db97e
commit
3d7f7c32e3
@ -104,7 +104,7 @@ static void adc_dma_intr_handler(void *arg);
|
||||
|
||||
static int8_t adc_digi_get_io_num(adc_unit_t adc_unit, uint8_t adc_channel)
|
||||
{
|
||||
assert(adc_unit <= SOC_ADC_PERIPH_NUM);
|
||||
assert(adc_unit < SOC_ADC_PERIPH_NUM);
|
||||
uint8_t adc_n = (adc_unit == ADC_UNIT_1) ? 0 : 1;
|
||||
return adc_channel_io_map[adc_n][adc_channel];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user