Re: [PATCH] iio: dac: mcp47feb02: reject out-of-range raw values

From: Andy Shevchenko

Date: Sun Oct 25 2026 - 17:07:43 EST


On Sun, Oct 25, 2026 at 08:50:16PM +0000, David CARLIER wrote:
> On Sun, 25 Oct 2026 at 20:37, Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
> wrote:
> > On Sat, Oct 24, 2026 at 10:44:23PM +0100, David Carlier wrote:

...

> > > case IIO_CHAN_INFO_RAW:
> > > + if (val < 0 || val >= BIT(data->chip_features->resolution))
> >
> > If resolution is 32, this will suck. (Yes, this is a bit theoretical case.)
> >
>
> Hmm true.
>
> > > + return -EINVAL;
> >
> > Not sure about this error code. Do other IIO drivers use same in the
> > similar situation?
>
> Yes other drivers for every out-of-range check IIO_CHAN_INFO_RAW.

No doubts. But I asked a different question. Can you answer it?

--
With Best Regards,
Andy Shevchenko