forked from luck/tmp_suning_uos_patched
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:
parent
010de20412
commit
892e62fab4
|
@ -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:
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user