iio: chemical: bme680: Add check for val2 in the write_raw function

val2 is responsible for the floating part of the number to be
written to the device. We don't need the floating part
while writing the oversampling ratio for BME680 since the
available oversampling ratios are pure natural numbers.

So, add a sanity check to make sure val2 is 0.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Himanshu Jha 2018-08-11 15:56:36 +05:30 committed by Jonathan Cameron
parent 010de20412
commit 892e62fab4

View File

@ -800,6 +800,9 @@ static int bme680_write_raw(struct iio_dev *indio_dev,
{
struct bme680_data *data = iio_priv(indio_dev);
if (val2 != 0)
return -EINVAL;
switch (mask) {
case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
{