From: Jonathan Cameron <jic23@kernel.org>
To: Himanshu Jha <himanshujha199640@gmail.com>
Cc: dpfrey@gmail.com, daniel.baluta@gmail.com,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: chemical: bme680: Add check for val2 in the write_raw function
Date: Sun, 19 Aug 2018 17:25:14 +0100 [thread overview]
Message-ID: <20180819172514.370d34fb@archlinux> (raw)
In-Reply-To: <20180811102636.6171-1-himanshujha199640@gmail.com>
On Sat, 11 Aug 2018 15:56:36 +0530
Himanshu Jha <himanshujha199640@gmail.com> wrote:
> 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>
As discussed in David's patch series v3, I think this is still relevant
but now needs an update to cover the new code.
Thanks,
Jonathan
> ---
> drivers/iio/chemical/bme680_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
> index 7d9bb62baa3f..9d5a05e054d1 100644
> --- a/drivers/iio/chemical/bme680_core.c
> +++ b/drivers/iio/chemical/bme680_core.c
> @@ -852,6 +852,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:
> switch (chan->type) {
next prev parent reply other threads:[~2018-08-19 19:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-11 10:26 [PATCH] iio: chemical: bme680: Add check for val2 in the write_raw function Himanshu Jha
2018-08-19 16:25 ` Jonathan Cameron [this message]
2018-08-19 17:10 ` Himanshu Jha
2018-08-19 19:08 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180819172514.370d34fb@archlinux \
--to=jic23@kernel.org \
--cc=daniel.baluta@gmail.com \
--cc=dpfrey@gmail.com \
--cc=himanshujha199640@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).