mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: proximity: isl29501: Fix return type of isl29501_register_write
@ 2026-09-17 13:00 Salah Triki
  2026-09-17 13:23 ` Joshua Crofts
  0 siblings, 1 reply; 2+ messages in thread
From: Salah Triki @ 2026-09-17 13:00 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko
  Cc: linux-iio, linux-kernel, Salah Triki

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.")
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/iio/proximity/isl29501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/isl29501.c b/drivers/iio/proximity/isl29501.c
index 95fb7238f678..a98a9975323c 100644
--- a/drivers/iio/proximity/isl29501.c
+++ b/drivers/iio/proximity/isl29501.c
@@ -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)
 {
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: proximity: isl29501: Fix return type of isl29501_register_write
  2026-09-17 13:00 [PATCH] iio: proximity: isl29501: Fix return type of isl29501_register_write Salah Triki
@ 2026-09-17 13:23 ` Joshua Crofts
  0 siblings, 0 replies; 2+ messages in thread
From: Joshua Crofts @ 2026-09-17 13:23 UTC (permalink / raw)
  To: Salah Triki
  Cc: Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, linux-iio, linux-kernel

On Thu, 17 Sep 2026 14:00:52 +0100
Salah Triki <salah.triki@gmail.com> 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.
> 
> Fixes: 1c28799257bc ("iio: light: isl29501: Add support for the ISL29501 ToF sensor.")
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---

Makes sense. I'd mark this for stable.

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>

-- 
Kind regards,
Joshua Crofts

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-17 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 13:00 [PATCH] iio: proximity: isl29501: Fix return type of isl29501_register_write Salah Triki
2026-09-17 13:23 ` Joshua Crofts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®