drivers: adc: lmp90xxx: validate ADC sequence channels mask

Validate the channels mask passed from adc_read().

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2020-03-26 12:52:48 +01:00 committed by Kumar Gala
parent 15be7a5723
commit ee97ab2bd8

View file

@ -495,6 +495,12 @@ static int lmp90xxx_adc_start_read(struct device *dev,
return -ENOTSUP;
}
if (!lmp90xxx_has_channel(dev, find_msb_set(sequence->channels) - 1)) {
LOG_ERR("unsupported channels in mask: 0x%08x",
sequence->channels);
return -ENOTSUP;
}
err = lmp90xxx_validate_buffer_size(sequence);
if (err) {
LOG_ERR("buffer size too small");