On Tue, Oct 23, 2012 at 7:05 PM, Eric Dumazet [off-list ref] wrote:
On Tue, 2012-10-23 at 13:56 +0200, Daniel Borkmann wrote:
quoted
This patch performs clean-ups of packet's err variables where appropriate.
In particular, errnos are *only* assigned in error cases, which saves
useless instructions in non-error cases and makes the code more readable
in terms of which error type belongs to which evaluated error condition.
Also, in some cases an errno was set, but not used until the next assignment.
I see no value in this patch.
Setting err before a test is a common way to handle error cases and
generates smaller code in linux kernel.
Better live with it than trying to change it ?
err = -ENOMEM;
match = kzalloc(xxxx);
if (!match)
goto error;
is smaller (source code & generated code) than :
match = kzalloc(xxxx);
if (!match) {
err = -ENOMEM;
goto error;
}
An immediate load is basically free, but code size matters.
Good to know, thanks for the feedback Eric!