* [PATCH] iio: chemical: bme680: Add check for val2 in the write_raw function
@ 2018-08-11 10:26 Himanshu Jha
2018-08-19 16:25 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Himanshu Jha @ 2018-08-11 10:26 UTC (permalink / raw)
To: jic23; +Cc: dpfrey, daniel.baluta, linux-iio, linux-kernel, Himanshu Jha
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>
---
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) {
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: chemical: bme680: Add check for val2 in the write_raw function
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
2018-08-19 17:10 ` Himanshu Jha
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2018-08-19 16:25 UTC (permalink / raw)
To: Himanshu Jha; +Cc: dpfrey, daniel.baluta, linux-iio, linux-kernel
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) {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: chemical: bme680: Add check for val2 in the write_raw function
2018-08-19 16:25 ` Jonathan Cameron
@ 2018-08-19 17:10 ` Himanshu Jha
2018-08-19 19:08 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Himanshu Jha @ 2018-08-19 17:10 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: dpfrey, daniel.baluta, linux-iio, linux-kernel
On Sun, Aug 19, 2018 at 05:25:14PM +0100, Jonathan Cameron wrote:
> 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.
I already had informed David to reabse his series on top of my patch
and he rebased this patch series.
So, it should apply cleanly without any further effort.
If it doesn't, then ping me.
--
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: chemical: bme680: Add check for val2 in the write_raw function
2018-08-19 17:10 ` Himanshu Jha
@ 2018-08-19 19:08 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2018-08-19 19:08 UTC (permalink / raw)
To: Himanshu Jha; +Cc: dpfrey, daniel.baluta, linux-iio, linux-kernel
On Sun, 19 Aug 2018 22:40:14 +0530
Himanshu Jha <himanshujha199640@gmail.com> wrote:
> On Sun, Aug 19, 2018 at 05:25:14PM +0100, Jonathan Cameron wrote:
> > 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.
>
> I already had informed David to reabse his series on top of my patch
> and he rebased this patch series.
>
> So, it should apply cleanly without any further effort.
>
> If it doesn't, then ping me.
Meh, was only some trivial fuzz. I thought things had changed more than that
as hadn't noticed you just applied it at the top of write_raw as all the
things that can be written in this driver are integers.
Anyhow, applied now. Thanks,
Jonathan
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-19 22:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2018-08-19 17:10 ` Himanshu Jha
2018-08-19 19:08 ` Jonathan Cameron
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).