summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-03-01 13:07:00 +0000
committerJonathan Cameron <jic23@kernel.org>2013-03-02 16:28:42 +0000
commitc5ef717a774b326a6708e2e14ddf9957b619d5c4 (patch)
treed9df99fd5a2b26e31344a379c95d52c7e16acfcc /drivers/iio
parenta26302628ad164980493ab7768a05a7f3a8d8842 (diff)
downloadblackbird-op-linux-c5ef717a774b326a6708e2e14ddf9957b619d5c4.tar.gz
blackbird-op-linux-c5ef717a774b326a6708e2e14ddf9957b619d5c4.zip
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>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/dac/ad5064.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index 7b777083cb48..f724a54bf334 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -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);
OpenPOWER on IntegriCloud