Skip to contentSkip to conversation

iio: light: veml6070: fix veml6070_read() return value

PATCH Superseded Aldo Conte 4 participants 7 messages Mar 25 – Mar 26 IIO

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Aldo Conte

author
#0 lore raw

PATCH 1/1 iio: light: veml6070: fix veml6070_read() return value

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")
---
 drivers/iio/light/veml6070.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/light/veml6070.c +1 -3
index 6d4483c85f30..74d7246e5225 100644
@@ -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[] = {
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Aldo Conte

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.

Quoted 7 lines

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")

---

Makes sense...

Quoted 18 lines

 drivers/iio/light/veml6070.c | 4 +---

 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/light/veml6070.c +0 -0
index 6d4483c85f30..74d7246e5225 100644
@@ -134,9 +134,7 @@ static int veml6070_read(struct veml6070_data *data)
  	if (ret < 0)
  		return ret;

drivers/iio/light/veml6070.c +1 -3
-	ret = (msb << 8) | lsb;
-
-	return 0;
+	return (msb << 8) | lsb;

 }

 static const struct iio_chan_spec veml6070_channels[] = {

maintainer
#2 lore raw
Quoted 11 lines · On Wed, 25 Mar 2026 12:31:29 +0000 Nuno Sá <[email protected]> wrote:
Quoted 10 lines · Aldo Conte

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.

Quoted 8 lines
Quoted 3 lines
Fixes bb18885ed823 ("iio: light: veml6070: add support for integration time")

---

Makes sense...

I'm not going to try and figure out how that one got through!

Any applied and marked for stable.

Thanks,

Jonathan

Quoted 18 lines
Quoted 18 lines

 drivers/iio/light/veml6070.c | 4 +---

 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/light/veml6070.c +0 -0
index 6d4483c85f30..74d7246e5225 100644
@@ -134,9 +134,7 @@ static int veml6070_read(struct veml6070_data *data)
  	if (ret < 0)
  		return ret;

drivers/iio/light/veml6070.c +1 -3
-	ret = (msb << 8) | lsb;
-
-	return 0;
+	return (msb << 8) | lsb;

 }

 static const struct iio_chan_spec veml6070_channels[] = {

#3 lore raw
In reply to Aldo Conte

Hi Aldo,

Quoted 10 lines · Aldo Conte

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")
Quoted 11 lines
Fixes bb18885ed823 ("iio: light: veml6070: add support for integration time")
---
 drivers/iio/light/veml6070.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/light/veml6070.c +0 -0
index 6d4483c85f30..74d7246e5225 100644

drivers/iio/light/veml6070.c static int veml6070_read(struct veml6070_data *data) · line 140

Quoted 10 lines
drivers/iio/light/veml6070.c +1 -3
@@ -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

maintainer
#4 lore raw
Quoted 14 lines · On Thu, 26 Mar 2026 10:30:46 +1100 "Javier Carrasco"…

Hi Aldo,

Quoted 10 lines · Aldo Conte

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.

Quoted 7 lines

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.

Quoted 24 lines
Quoted 11 lines
Fixes bb18885ed823 ("iio: light: veml6070: add support for integration time")
---
 drivers/iio/light/veml6070.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/light/veml6070.c +0 -0
index 6d4483c85f30..74d7246e5225 100644

drivers/iio/light/veml6070.c static int veml6070_read(struct veml6070_data *data) · line 140

Quoted 10 lines
drivers/iio/light/veml6070.c +1 -3
@@ -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

author
#5 lore raw
In reply to Javier Carrasco
Quoted 41 lines · Javier Carrasco

Hi Aldo,

Quoted 10 lines · Aldo Conte

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")
Quoted 20 lines
Fixes bb18885ed823 ("iio: light: veml6070: add support for integration time")
---
  drivers/iio/light/veml6070.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/light/veml6070.c +1 -3
index 6d4483c85f30..74d7246e5225 100644
@@ -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;
  }
 
Quoted 4 lines

drivers/iio/light/veml6070.c static int veml6070_read(struct veml6070_data *data) · line 140

Quoted 1 line
drivers/iio/light/veml6070.c +0 -0
  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

maintainer
#6 lore raw
Quoted 42 lines · On Thu, 26 Mar 2026 14:14:16 +0100 Aldo Conte <[email protected]> wrote:
Quoted 41 lines · Javier Carrasco

Hi Aldo,

Quoted 10 lines · Aldo Conte

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")
Quoted 20 lines
Fixes bb18885ed823 ("iio: light: veml6070: add support for integration time")
---
  drivers/iio/light/veml6070.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/light/veml6070.c +1 -3
index 6d4483c85f30..74d7246e5225 100644
@@ -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;
  }
 
Quoted 7 lines
Quoted 4 lines

drivers/iio/light/veml6070.c static int veml6070_read(struct veml6070_data *data) · line 140

Quoted 1 line
drivers/iio/light/veml6070.c +0 -0
  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

Quoted 3 lines

Thanks,
Aldo