[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aYGxa1E9WnYLXlet@smile.fi.intel.com>
Date: Tue, 3 Feb 2026 10:27:23 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Antoniu Miclaus <antoniu.miclaus@...log.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>,
Waqar Hameed <waqar.hameed@...s.com>,
chuguangqing <chuguangqing@...pur.com>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] iio: light: ltr501: return proper error code from
ltr501_get_gain_index()
On Mon, Feb 02, 2026 at 02:07:12PM +0200, Antoniu Miclaus wrote:
> 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.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@...el.com>
...
> 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;
I would use -ENOENT, but I'm not sure if there is any ABI involved (id est we
return this to user space).
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists