Re: [PATCH v10 3/3] iio: dac: Add AD5529R DAC driver support

From: Andy Shevchenko

Date: Mon Aug 31 2026 - 03:13:16 EST


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.

> > > + "Channel %u exceeds maximum 15\n",

--
With Best Regards,
Andy Shevchenko