From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Antoniu Miclaus <antoniu.miclaus@analog.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Waqar Hameed" <waqar.hameed@axis.com>,
chuguangqing <chuguangqing@inspur.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: light: ltr501: return proper error code from ltr501_get_gain_index()
Date: Tue, 3 Feb 2026 10:27:23 +0200 [thread overview]
Message-ID: <aYGxa1E9WnYLXlet@smile.fi.intel.com> (raw)
In-Reply-To: <20260202120715.25625-1-antoniu.miclaus@analog.com>
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@intel.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
next prev parent reply other threads:[~2026-02-03 8:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 12:07 [PATCH v2] iio: light: ltr501: return proper error code from ltr501_get_gain_index() Antoniu Miclaus
2026-02-02 12:25 ` Waqar Hameed
2026-02-03 8:27 ` Andy Shevchenko [this message]
2026-02-07 15:54 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aYGxa1E9WnYLXlet@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=antoniu.miclaus@analog.com \
--cc=chuguangqing@inspur.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=waqar.hameed@axis.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox