Commit 9a26578c authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Jonathan Cameron

staging:iio:adxrs450: Reject out of range calibscale values

Instead of silently discarding the upper bits reject out of range values for the
calibscale property.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent c62b89c7
...@@ -258,9 +258,10 @@ static int adxrs450_write_raw(struct iio_dev *indio_dev, ...@@ -258,9 +258,10 @@ static int adxrs450_write_raw(struct iio_dev *indio_dev,
int ret; int ret;
switch (mask) { switch (mask) {
case IIO_CHAN_INFO_CALIBBIAS: case IIO_CHAN_INFO_CALIBBIAS:
if (val < -0x400 || val >= 0x400)
return -EINVAL;
ret = adxrs450_spi_write_reg_16(indio_dev, ret = adxrs450_spi_write_reg_16(indio_dev,
ADXRS450_DNC1, ADXRS450_DNC1, val);
val & 0x3FF);
break; break;
default: default:
ret = -EINVAL; ret = -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment