Re: [PATCH v10 3/3] iio: dac: Add AD5529R DAC driver support
From: Jonathan Cameron
Date: Mon Aug 31 2026 - 21:38:23 EST
On Mon, 31 Aug 2026 10:10:25 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> On Mon, Aug 31, 2026 at 12:16:12AM +0100, Jonathan Cameron wrote:
>
> ...
>
> > > > + device_for_each_child_node_scoped(dev, child) {
> > > > + if (st->num_channels == ARRAY_SIZE(st->channels))
> > > > + return dev_err_probe(dev, -ECHRNG, "Too many channels\n");
> > >
> > > Okay, this actually better to be ENOSPC
> > >
> > > > + ret = fwnode_property_read_u32(child, "reg", &ch);
> > > > + if (ret)
> > > > + return dev_err_probe(dev, ret,
> > > > + "Missing reg property in channel node\n");
> > > > +
> > > > + if (ch >= AD5529R_MAX_CHANNELS)
> > > > + return dev_err_probe(dev, -EINVAL,
> > >
> > > and ECHRNG is here.
> >
> > That one is getting rather creative even though I guess the description
> > does fit rather well. So I don't object, but also feel -EINVAL is
> > probably good enough for an invalid property value.
>
> But missing property message propagates the fwnode return code (which will be
> EINVAL IIRC). So the above is not about missing property, it's about wrong
> channel. Note, I have checked uses of ECHRNG in the kernel, and many of them
> are fine with the suggested one.
Fair enough and works for me. We can add this to the list of things
to tidy up if we happen to be touching other code that deals with
wrong channel numbers. Not something we want to generate churn though
unless there are far fewer instances of this than I think there are!
Jonathan
>
> > > > + "Channel %u exceeds maximum 15\n",
>