Re: [v2] iio: core: move 'indio_dev->info' null check first
From: Ardelean, Alexandru
Date: Tue Apr 07 2020 - 07:30:02 EST
On Tue, 2020-04-07 at 11:01 +0000, Ardelean, Alexandru wrote:
> [External]
>
> On Tue, 2020-04-07 at 12:42 +0200, Markus Elfring wrote:
> > [External]
> >
> > > So, over time I got the habit of mentioning 'Doesn't fix anything.'
> >
> > I suggest to reconsider such information once more.
> > We come along different interpretations for remarkable software adjustments.
> >
> >
> > > if the patch doesn't fix anything.
> >
> > Do you improve the input parameter validation a bit in principle here?
>
> I thought that was obvious from the rest of the description + patch.
> I guess it isn't.
>
> I'll see.
So, how about this:
---------------------------------------------
Doesn't fix anything. Just moves this to be the first check, as it's very
simple and fails the registration earlier, instead of potentially
initializing the 'indio_dev->label' and checking for duplicate indexes, and
then failing with this simple-check.
This is a minor optimization, since '__iio_device_register()' will waste
fewer validation cycles in case 'indio_dev->info' is NULL.
---------------------------------------------
?
>
> > Regards,
> > Markus