mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 18:09:57 +00:00
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
1 changed files with 3 additions and 0 deletions
|
@ -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 a new issue