Skip to contentSkip to conversation

iio: proximity: isl29501: Fix return type of isl29501_register_write

PATCH In review Salah Triki 3 participants 3 messages Sep 17 – Sep 20 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: proximity: isl29501: Fix return type of isl29501_register_write

isl29501_register_write() was returning a u32 instead of an int. Since the function returns negative error codes (such as -ERANGE or return values from i2c_smbus_write_byte_data()), returning an unsigned integer type prevents callers from correctly checking for negative error conditions.

Fix this by changing the function return type from u32 to int.

This was found through manual code review.

Fixes 1c28799257bc ("iio: light: isl29501: Add support for the ISL29501 ToF sensor.")
---
 drivers/iio/proximity/isl29501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/isl29501.c +1 -1
index 95fb7238f678..a98a9975323c 100644
@@ -226,7 +226,7 @@ static int isl29501_register_read(struct isl29501_private *isl29501,
 	return ret;
 }
 
-static u32 isl29501_register_write(struct isl29501_private *isl29501,
+static int isl29501_register_write(struct isl29501_private *isl29501,
 				   enum isl29501_register_name name,
 				   u32 value)
 {
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · On Thu, 17 Sep 2026 14:00:52 +0100 Salah Triki <[email protected]> wrote:

isl29501_register_write() was returning a u32 instead of an int. Since the function returns negative error codes (such as -ERANGE or return values from i2c_smbus_write_byte_data()), returning an unsigned integer type prevents callers from correctly checking for negative error conditions.

Quoted 7 lines

Fix this by changing the function return type from u32 to int.

This was found through manual code review.

Fixes 1c28799257bc ("iio: light: isl29501: Add support for the ISL29501 ToF sensor.")

---

Makes sense. I'd mark this for stable.

Signature · 2 lines
Kind regards,
Joshua Crofts
maintainer
#2 lore raw
Quoted 13 lines · On Thu, 17 Sep 2026 15:23:39 +0200 Joshua Crofts <[email protected]>…
Quoted 10 lines · On Thu, 17 Sep 2026 14:00:52 +0100 Salah Triki <[email protected]> wrote:

isl29501_register_write() was returning a u32 instead of an int. Since the function returns negative error codes (such as -ERANGE or return values from i2c_smbus_write_byte_data()), returning an unsigned integer type prevents callers from correctly checking for negative error conditions.

Fix this by changing the function return type from u32 to int.

This was found through manual code review.

Quoted 7 lines
Quoted 3 lines
Fixes 1c28799257bc ("iio: light: isl29501: Add support for the ISL29501 ToF sensor.")

---

Makes sense. I'd mark this for stable.

Applied and marked for stable. Note this doesn't mean it will go upstream particularly quickly. Most likely I'll be folding the fixes into the pull request for the next merge window.

Thanks,

Jonathan

Quoted 1 line