iio:ad5064: Fix off by one in DAC value range check
The DAC value range check allows values one larger than the maximum value, which effectively results in setting the DAC value to 0. This patch fixes the issue. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Šī revīzija ir iekļauta:

revīziju iesūtīja
Jonathan Cameron

vecāks
a26302628a
revīzija
c5ef717a77
@@ -257,7 +257,7 @@ static int ad5064_write_raw(struct iio_dev *indio_dev,
|
||||
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_RAW:
|
||||
if (val > (1 << chan->scan_type.realbits) || val < 0)
|
||||
if (val >= (1 << chan->scan_type.realbits) || val < 0)
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&indio_dev->mlock);
|
||||
|
Atsaukties uz šo jaunā problēmā
Block a user