Re: [PATCH 1/2] iio: adc: ad7124: Don't create more channels than the hardware is capable of

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Nuno,

On Mon, Nov 11, 2024 at 11:37:46AM +0100, Nuno Sá wrote:
> On Fri, 2024-11-08 at 19:18 +0100, Uwe Kleine-König wrote:
> > @@ -821,6 +822,11 @@ static int ad7124_parse_channel_config(struct iio_dev
> > *indio_dev,
> >  	if (!st->num_channels)
> >  		return dev_err_probe(dev, -ENODEV, "no channel children\n");
> >  
> > +	if (st->num_channels > AD7124_MAX_CHANNELS) {
> > +		dev_warn(dev, "Limit number of channels to "
> > __stringify(AD7124_MAX_CHANNELS) "\n");
> > +		st->num_channels = AD7124_MAX_CHANNELS;
> > +	}
> 
> Hmmm, I would treat it as an error...

Well, it probably results in an error further below when the first child
is hit that uses a too high reg property. I considered erroring out
here, but thought this might not be justified if some children are not
logical channels. I'm not sure either way, but can rework accordingly if
all other concerns are resolved.

Best regards
Uwe

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux