Re: [PATCH] iio: light: veml6070: fix veml6070_read() return value

From: Jonathan Cameron

Date: Thu Mar 26 2026 - 04:32:31 EST


On Thu, 26 Mar 2026 10:30:46 +1100
"Javier Carrasco" <javier.carrasco.cruz@xxxxxxxxx> 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@xxxxxxxxx>
> > ---
> > 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