Skip to contentSkip to conversation

iio: core: move 'indio_dev->info' null check first

PATCH Markus Elfring 2 participants 6 messages Apr 7, 2020 IIO

lore
Share & tools
lore
#1 lore raw
Quoted 6 lines · Markus Elfring

[External]

Quoted 1 line

Doesn't fix anything.

Would the change description be nicer without this sentence?

That part is slightly debate-able.
I've had my fair-share of comments [during reviews], where others were asking/saying "is this fixing anything? please state if this is fixing anything".

So, over time I got the habit of mentioning 'Doesn't fix anything.' if the patch doesn't fix anything.

So, I'd leave it as-is [if that's possible].

Quoted 6 lines
Quoted 2 lines

Just moves this …

I suggest to choose an imperative wording.
https://urldefense.com/v3/__https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=7e63420847ae5f1036e4f7c42f0b3282e73efbc2*n151__;Iw!!A3Ni8CS0y2Y!pMoqZILvWyu87fkNe16Sua0jMrZZK81oQOHENUhyTWZz9UrY4CisyKWSRCPFws0WTm50iQ$

I admit, I didn't read that document too much in-depth. And I probably won't, because I am lazy.

Personally, what I try to do, is guess the maintainer's/community's preferences over time via interactions.
Things differ slightly from community to community.
Of course, there is some common ground across all communities, and I try to apply that first.
Then, depending on the flexibility/past-comments from other sent-patches I try to apply those on top [unless I forget; which I kinda do].

Quoted 2 lines

Regards,
Markus

#2 lore raw
Quoted 1 line

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.

Quoted 1 line

if the patch doesn't fix anything.

Do you improve the input parameter validation a bit in principle here?

Regards,
Markus

#3 lore raw
Quoted 11 lines · Markus Elfring

[External]

Quoted 1 line

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.

Quoted 1 line

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.

Quoted 3 lines

Regards,
Markus

#4 lore raw
Quoted 11 lines · Alexandru

[External]

Quoted 8 lines · Markus Elfring

[External]

Quoted 1 line

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.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

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.
---------------------------------------------
?

Quoted 3 lines
Quoted 3 lines

Regards,
Markus

#5 lore raw
Quoted 1 line

Doesn't fix anything.

You would like to change something for a specific reason. Thus please omit this sentence.

Quoted 1 line

Just moves this to be the first check, as it's very …

Wording alternative:
Move a null pointer check to the beginning of this function implementation.

Quoted 2 lines

This is a minor optimization, since '__iio_device_register()' will waste fewer validation cycles in case 'indio_dev->info' is NULL.

How do you think about to use the text “iio: core: Improve input parameter validation in __iio_device_register()” as a commit subject?

Regards,
Markus