boards: arm: stm32: fix out of bounds access

Fix an out of bounds access when `CONFIG_SOC_SERIES_STM32F1X` is
enabled.

Signed-off-by: Noah Pendleton <noah.pendleton@gmail.com>
This commit is contained in:
Noah Pendleton 2019-10-08 10:04:12 -04:00 committed by Maureen Helm
commit d68de09c0f

View file

@ -246,10 +246,14 @@ static int start_read(struct device *dev, const struct adc_sequence *sequence)
case 10: case 10:
resolution = table_resolution[2]; resolution = table_resolution[2];
break; break;
#endif
case 12: case 12:
resolution = table_resolution[3]; resolution = table_resolution[3];
break; break;
#else
case 12:
resolution = table_resolution[0];
break;
#endif
default: default:
LOG_ERR("Invalid resolution"); LOG_ERR("Invalid resolution");
return -EINVAL; return -EINVAL;