Re: [PATCH v2 0/2] iio: proximity: sx9310/sx9360: reject out-of-range hardware gain values
From: Andy Shevchenko
Date: Mon Nov 09 2026 - 13:52:35 EST
On Mon, Nov 09, 2026 at 10:21:51PM +0530, Arnav Kapoor wrote:
> sx9310_write_gain() and sx9360_write_gain() squeeze ilog2() of any
> integer into the register field. Values that don't fit wrap around,
> and 0 and negative values turn into the maximum code, while the write
> reports success. Reject those. One patch per driver, as the Fixes tags
> differ.
I would change the error code to -ERANGE which is clearly states that the range
for numbers is wrong (like mathematically). -EINVAL is way too far overloaded
with semantics.
--
With Best Regards,
Andy Shevchenko