mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: light: ltr501: return proper error code from ltr501_get_gain_index()
@ 2026-01-30 13:52 Antoniu Miclaus
  2026-01-31 17:11 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Antoniu Miclaus @ 2026-01-30 13:52 UTC (permalink / raw)
  To: Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Waqar Hameed, chuguangqing, Antoniu Miclaus,
	linux-iio, linux-kernel

Return -EINVAL instead of -1 when no matching gain value is found
in the gain table. Using standard kernel error codes ensures
consistency and proper error handling.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/light/ltr501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 022e0693983b..29e93986dea6 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -754,7 +754,7 @@ static int ltr501_get_gain_index(const struct ltr501_gain *gain, int size,
 		if (val == gain[i].scale && val2 == gain[i].uscale)
 			return i;
 
-	return -1;
+	return -EINVAL;
 }
 
 static int __ltr501_write_raw(struct iio_dev *indio_dev,
-- 
2.43.0


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

end of thread, other threads:[~2026-01-31 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-30 13:52 [PATCH] iio: light: ltr501: return proper error code from ltr501_get_gain_index() Antoniu Miclaus
2026-01-31 17:11 ` Jonathan Cameron

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®