Re: [PATCH v1 4/4] iio: light: opt4001: Fix reversed GENMASK() arguments in fault count mask
From: Jonathan Cameron
Date: Sun Jul 12 2026 - 20:45:58 EST
On Mon, 13 Jul 2026 01:54:51 +0530
Nikhil Gautam <nikhilgtr@xxxxxxxxx> wrote:
> GENMASK(h, l) requires h >= l, but OPT4001_CTRL_FAULT_COUNT is defined
> as GENMASK(0, 1). The define is currently unused so there is no
> functional impact, but fix it before anyone builds on it, and add the
> _MASK suffix for consistency with the neighbouring definitions.
>
> Signed-off-by: Nikhil Gautam <nikhilgtr@xxxxxxxxx>
Another good spot. I guess it is just about worth a fixes tag as
someone might add support that needs this then backport that missing this
fix otherwise.
Jonathan
> ---
> drivers/iio/light/opt4001.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/light/opt4001.c b/drivers/iio/light/opt4001.c
> index 31a5397926eb..294532bcbc50 100644
> --- a/drivers/iio/light/opt4001.c
> +++ b/drivers/iio/light/opt4001.c
> @@ -39,7 +39,7 @@
> #define OPT4001_CTRL_OPER_MODE_MASK GENMASK(5, 4)
> #define OPT4001_CTRL_LATCH_MASK GENMASK(3, 3)
> #define OPT4001_CTRL_INT_POL_MASK GENMASK(2, 2)
> -#define OPT4001_CTRL_FAULT_COUNT GENMASK(0, 1)
> +#define OPT4001_CTRL_FAULT_COUNT_MASK GENMASK(1, 0)
>
> /* OPT4001 constants */
> #define OPT4001_DEVICE_ID_VAL 0x121