iio: light: ltr501: return proper error code from ltr501_get_gain_index()

Return -EINVAL instead of -1 when no matching gain value is found
in the gain table. Update the callers to propagate this error directly
rather than overwriting it with -EINVAL.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Waqar Hameed <waqar.hameed@axis.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Antoniu Miclaus 2026-02-02 14:07:12 +02:00 • committed by Jonathan Cameron
commit 1ff6d25d69