* [PATCH] iio: light: veml6070: fix veml6070_read() return value
@ 2026-03-25 11:32 Aldo Conte
2026-03-25 12:31 ` Nuno Sá
2026-03-25 23:30 ` Javier Carrasco
0 siblings, 2 replies; 7+ messages in thread
From: Aldo Conte @ 2026-03-25 11:32 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-iio, linux-kernel, David Lechner, Nuno Sá,
Andy Shevchenko, Javier Carrasco
veml6070_read() computes the sensor value in ret but
returns 0 instead of the actual result. This causes
veml6070_read_raw() to always report 0.
Return the computed value instead of 0.
Running make W=1 returns no errors. I was unable
to test the patch because I do not have the hardware.
Found by code inspection.
Fixes: bb18885ed823 ("iio: light: veml6070: add support for integration time")
Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
---
drivers/iio/light/veml6070.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c
index 6d4483c85f30..74d7246e5225 100644
--- a/drivers/iio/light/veml6070.c
+++ b/drivers/iio/light/veml6070.c
@@ -134,9 +134,7 @@ static int veml6070_read(struct veml6070_data *data)
if (ret < 0)
return ret;
- ret = (msb << 8) | lsb;
-
- return 0;
+ return (msb << 8) | lsb;
}
static const struct iio_chan_spec veml6070_channels[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: light: veml6070: fix veml6070_read() return value
2026-03-25 11:32 [PATCH] iio: light: veml6070: fix veml6070_read() return value Aldo Conte
@ 2026-03-25 12:31 ` Nuno Sá
2026-03-25 16:35 ` Jonathan Cameron
2026-03-25 23:30 ` Javier Carrasco
1 sibling, 1 reply; 7+ messages in thread
From: Nuno Sá @ 2026-03-25 12:31 UTC (permalink / raw)
To: Aldo Conte, Jonathan Cameron
Cc: linux-iio, linux-kernel, David Lechner, Nuno Sá,
Andy Shevchenko, Javier Carrasco
On Wed, 2026-03-25 at 12:32 +0100, Aldo Conte wrote:
> veml6070_read() computes the sensor value in ret but
> returns 0 instead of the actual result. This causes
> veml6070_read_raw() to always report 0.
>
> Return the computed value instead of 0.
>
> Running make W=1 returns no errors. I was unable
> to test the patch because I do not have the hardware.
> Found by code inspection.
>
> Fixes: bb18885ed823 ("iio: light: veml6070: add support for integration time")
> Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
> ---
Makes sense...
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> drivers/iio/light/veml6070.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c
> index 6d4483c85f30..74d7246e5225 100644
> --- a/drivers/iio/light/veml6070.c
> +++ b/drivers/iio/light/veml6070.c
> @@ -134,9 +134,7 @@ static int veml6070_read(struct veml6070_data *data)
> if (ret < 0)
> return ret;
>
> - ret = (msb << 8) | lsb;
> -
> - return 0;
> + return (msb << 8) | lsb;
> }
>
> static const struct iio_chan_spec veml6070_channels[] = {
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: light: veml6070: fix veml6070_read() return value
2026-03-25 12:31 ` Nuno Sá
@ 2026-03-25 16:35 ` Jonathan Cameron
0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2026-03-25 16:35 UTC (permalink / raw)
To: Nuno Sá
Cc: Aldo Conte, linux-iio, linux-kernel, David Lechner, Nuno Sá,
Andy Shevchenko, Javier Carrasco
On Wed, 25 Mar 2026 12:31:29 +0000
Nuno Sá <noname.nuno@gmail.com> wrote:
> On Wed, 2026-03-25 at 12:32 +0100, Aldo Conte wrote:
> > veml6070_read() computes the sensor value in ret but
> > returns 0 instead of the actual result. This causes
> > veml6070_read_raw() to always report 0.
> >
> > Return the computed value instead of 0.
> >
> > Running make W=1 returns no errors. I was unable
> > to test the patch because I do not have the hardware.
> > Found by code inspection.
> >
> > Fixes: bb18885ed823 ("iio: light: veml6070: add support for integration time")
> > Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
> > ---
>
> Makes sense...
>
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>
>
I'm not going to try and figure out how that one got through!
Any applied and marked for stable.
Thanks,
Jonathan
> > drivers/iio/light/veml6070.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c
> > index 6d4483c85f30..74d7246e5225 100644
> > --- a/drivers/iio/light/veml6070.c
> > +++ b/drivers/iio/light/veml6070.c
> > @@ -134,9 +134,7 @@ static int veml6070_read(struct veml6070_data *data)
> > if (ret < 0)
> > return ret;
> >
> > - ret = (msb << 8) | lsb;
> > -
> > - return 0;
> > + return (msb << 8) | lsb;
> > }
> >
> > static const struct iio_chan_spec veml6070_channels[] = {
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: light: veml6070: fix veml6070_read() return value
2026-03-25 11:32 [PATCH] iio: light: veml6070: fix veml6070_read() return value Aldo Conte
2026-03-25 12:31 ` Nuno Sá
@ 2026-03-25 23:30 ` Javier Carrasco
2026-03-26 8:23 ` Jonathan Cameron
2026-03-26 13:14 ` Aldo Conte
1 sibling, 2 replies; 7+ messages in thread
From: Javier Carrasco @ 2026-03-25 23:30 UTC (permalink / raw)
To: Aldo Conte, Jonathan Cameron
Cc: linux-iio, linux-kernel, David Lechner, Nuno Sá,
Andy Shevchenko
Hi Aldo,
On Wed Mar 25, 2026 at 10:32 PM AEDT, Aldo Conte wrote:
> veml6070_read() computes the sensor value in ret but
> returns 0 instead of the actual result. This causes
> veml6070_read_raw() to always report 0.
>
> Return the computed value instead of 0.
>
> Running make W=1 returns no errors. I was unable
> to test the patch because I do not have the hardware.
> Found by code inspection.
>
The fix is correct, but not the commit it addresses.
This bug was introduced when the guard to handle the mutex was added.
It should be:
Fixes: fc38525135dd ("iio: light: veml6070: use guard to handle mutex")
> Fixes: bb18885ed823 ("iio: light: veml6070: add support for integration time")
> Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
> ---
> drivers/iio/light/veml6070.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c
> index 6d4483c85f30..74d7246e5225 100644
> --- a/drivers/iio/light/veml6070.c
> +++ b/drivers/iio/light/veml6070.c
> @@ -134,9 +134,7 @@ static int veml6070_read(struct veml6070_data *data)
> if (ret < 0)
> return ret;
>
> - ret = (msb << 8) | lsb;
> -
> - return 0;
> + return (msb << 8) | lsb;
> }
>
> static const struct iio_chan_spec veml6070_channels[] = {
Best regards,
Javier
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: light: veml6070: fix veml6070_read() return value
2026-03-25 23:30 ` Javier Carrasco
@ 2026-03-26 8:23 ` Jonathan Cameron
2026-03-26 13:14 ` Aldo Conte
1 sibling, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2026-03-26 8:23 UTC (permalink / raw)
To: Javier Carrasco
Cc: Aldo Conte, linux-iio, linux-kernel, David Lechner, Nuno Sá,
Andy Shevchenko
On Thu, 26 Mar 2026 10:30:46 +1100
"Javier Carrasco" <javier.carrasco.cruz@gmail.com> wrote:
> Hi Aldo,
>
> On Wed Mar 25, 2026 at 10:32 PM AEDT, Aldo Conte wrote:
> > veml6070_read() computes the sensor value in ret but
> > returns 0 instead of the actual result. This causes
> > veml6070_read_raw() to always report 0.
> >
> > Return the computed value instead of 0.
> >
> > Running make W=1 returns no errors. I was unable
> > to test the patch because I do not have the hardware.
> > Found by code inspection.
> >
>
> The fix is correct, but not the commit it addresses.
> This bug was introduced when the guard to handle the mutex was added.
>
> It should be:
>
> Fixes: fc38525135dd ("iio: light: veml6070: use guard to handle mutex")
>
Ah. A bug slipping in during that makes more sense. Changed.
> > Fixes: bb18885ed823 ("iio: light: veml6070: add support for integration time")
> > Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
> > ---
> > drivers/iio/light/veml6070.c | 4 +---
> > 1 file changed, 1 insertion(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c
> > index 6d4483c85f30..74d7246e5225 100644
> > --- a/drivers/iio/light/veml6070.c
> > +++ b/drivers/iio/light/veml6070.c
> > @@ -134,9 +134,7 @@ static int veml6070_read(struct veml6070_data *data)
> > if (ret < 0)
> > return ret;
> >
> > - ret = (msb << 8) | lsb;
> > -
> > - return 0;
> > + return (msb << 8) | lsb;
> > }
> >
> > static const struct iio_chan_spec veml6070_channels[] = {
>
> Best regards,
> Javier
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: light: veml6070: fix veml6070_read() return value
2026-03-25 23:30 ` Javier Carrasco
2026-03-26 8:23 ` Jonathan Cameron
@ 2026-03-26 13:14 ` Aldo Conte
2026-03-26 20:23 ` Jonathan Cameron
1 sibling, 1 reply; 7+ messages in thread
From: Aldo Conte @ 2026-03-26 13:14 UTC (permalink / raw)
To: Javier Carrasco, Jonathan Cameron
Cc: linux-iio, linux-kernel, David Lechner, Nuno Sá,
Andy Shevchenko
On 3/26/26 00:30, Javier Carrasco wrote:
> Hi Aldo,
>
> On Wed Mar 25, 2026 at 10:32 PM AEDT, Aldo Conte wrote:
>> veml6070_read() computes the sensor value in ret but
>> returns 0 instead of the actual result. This causes
>> veml6070_read_raw() to always report 0.
>>
>> Return the computed value instead of 0.
>>
>> Running make W=1 returns no errors. I was unable
>> to test the patch because I do not have the hardware.
>> Found by code inspection.
>>
>
> The fix is correct, but not the commit it addresses.
> This bug was introduced when the guard to handle the mutex was added.
>
> It should be:
>
> Fixes: fc38525135dd ("iio: light: veml6070: use guard to handle mutex")
>
>> Fixes: bb18885ed823 ("iio: light: veml6070: add support for integration time")
>> Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
>> ---
>> drivers/iio/light/veml6070.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c
>> index 6d4483c85f30..74d7246e5225 100644
>> --- a/drivers/iio/light/veml6070.c
>> +++ b/drivers/iio/light/veml6070.c
>> @@ -134,9 +134,7 @@ static int veml6070_read(struct veml6070_data *data)
>> if (ret < 0)
>> return ret;
>>
>> - ret = (msb << 8) | lsb;
>> -
>> - return 0;
>> + return (msb << 8) | lsb;
>> }
>>
>> static const struct iio_chan_spec veml6070_channels[] = {
>
> Best regards,
> Javier
Hi Javier,Thank you for your correction.
I got the wrong result from the grep command.
Do I need to do a review, or is Jonathan's correction enough?
Thanks,
Aldo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] iio: light: veml6070: fix veml6070_read() return value
2026-03-26 13:14 ` Aldo Conte
@ 2026-03-26 20:23 ` Jonathan Cameron
0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2026-03-26 20:23 UTC (permalink / raw)
To: Aldo Conte
Cc: Javier Carrasco, linux-iio, linux-kernel, David Lechner,
Nuno Sá, Andy Shevchenko
On Thu, 26 Mar 2026 14:14:16 +0100
Aldo Conte <aldocontelk@gmail.com> wrote:
> On 3/26/26 00:30, Javier Carrasco wrote:
> > Hi Aldo,
> >
> > On Wed Mar 25, 2026 at 10:32 PM AEDT, Aldo Conte wrote:
> >> veml6070_read() computes the sensor value in ret but
> >> returns 0 instead of the actual result. This causes
> >> veml6070_read_raw() to always report 0.
> >>
> >> Return the computed value instead of 0.
> >>
> >> Running make W=1 returns no errors. I was unable
> >> to test the patch because I do not have the hardware.
> >> Found by code inspection.
> >>
> >
> > The fix is correct, but not the commit it addresses.
> > This bug was introduced when the guard to handle the mutex was added.
> >
> > It should be:
> >
> > Fixes: fc38525135dd ("iio: light: veml6070: use guard to handle mutex")
> >
> >> Fixes: bb18885ed823 ("iio: light: veml6070: add support for integration time")
> >> Signed-off-by: Aldo Conte <aldocontelk@gmail.com>
> >> ---
> >> drivers/iio/light/veml6070.c | 4 +---
> >> 1 file changed, 1 insertion(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/iio/light/veml6070.c b/drivers/iio/light/veml6070.c
> >> index 6d4483c85f30..74d7246e5225 100644
> >> --- a/drivers/iio/light/veml6070.c
> >> +++ b/drivers/iio/light/veml6070.c
> >> @@ -134,9 +134,7 @@ static int veml6070_read(struct veml6070_data *data)
> >> if (ret < 0)
> >> return ret;
> >>
> >> - ret = (msb << 8) | lsb;
> >> -
> >> - return 0;
> >> + return (msb << 8) | lsb;
> >> }
> >>
> >> static const struct iio_chan_spec veml6070_channels[] = {
> >
> > Best regards,
> > Javier
> Hi Javier,Thank you for your correction.
> I got the wrong result from the grep command.
> Do I need to do a review, or is Jonathan's correction enough?
It's applied on my tree so all good - no need to do anything.
Thanks,
Jonathan
>
> Thanks,
> Aldo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-26 20:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 11:32 [PATCH] iio: light: veml6070: fix veml6070_read() return value Aldo Conte
2026-03-25 12:31 ` Nuno Sá
2026-03-25 16:35 ` Jonathan Cameron
2026-03-25 23:30 ` Javier Carrasco
2026-03-26 8:23 ` Jonathan Cameron
2026-03-26 13:14 ` Aldo Conte
2026-03-26 20:23 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox