diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2015-05-27 11:20:52 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-06-01 16:55:19 +0100 |
commit | 5517547bf44731621338c1a4047196a49c790719 (patch) | |
tree | 51e0b50fa205cc2623a530a2e40521223a78aa16 /drivers/iio | |
parent | 1e1ec2861e0d4307267096c3f74c17298c1cde98 (diff) | |
download | op-kernel-dev-5517547bf44731621338c1a4047196a49c790719.zip op-kernel-dev-5517547bf44731621338c1a4047196a49c790719.tar.gz |
iio: magnetometer: correct a harmless off by one check
The line before limits i to 0-3 so the existing code works fine but the
check is still off by one and >= is intended instead of >.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/magnetometer/mmc35240.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c index aa6e25d..c71392c 100644 --- a/drivers/iio/magnetometer/mmc35240.c +++ b/drivers/iio/magnetometer/mmc35240.c @@ -308,7 +308,7 @@ static int mmc35240_read_raw(struct iio_dev *indio_dev, return ret; i = (reg & MMC35240_CTRL1_BW_MASK) >> MMC35240_CTRL1_BW_SHIFT; - if (i < 0 || i > ARRAY_SIZE(mmc35240_samp_freq)) + if (i < 0 || i >= ARRAY_SIZE(mmc35240_samp_freq)) return -EINVAL; *val = mmc35240_samp_freq[i]; |