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:
parent
15be7a5723
commit
ee97ab2bd8
1 changed files with 6 additions and 0 deletions
|
@ -495,6 +495,12 @@ static int lmp90xxx_adc_start_read(struct device *dev,
|
||||||
return -ENOTSUP;
|
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);
|
err = lmp90xxx_validate_buffer_size(sequence);
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("buffer size too small");
|
LOG_ERR("buffer size too small");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue