Re: s390/net: Deletion of unnecessary checks before two function calls

From: Julia Lawall
Date: Mon Nov 03 2014 - 12:02:24 EST


> > After your patch then it will print warning messages.
> > After: You have to remember that rtw_free_netdev() accepts NULL
> > pointers but free_netdev() does not accept NULL pointers.
>
> Are any improvements needed for the corresponding documentation to make it
> better accessible besides the source code?

When people are writing or reading code, they will not necessarily look at
the documentation for every function that they use.

> > The if statements are there for *human* readers to understand and you are
> > making it harder for humans to understand the code.
>
> Is there a target conflict between source code understandability
> and software efficiency?

Efficiency is not an issue. This code is all in rare error handling paths
or in service removal functions. None of it is in a critical path. What
is important is to be able to easily check that what needs to be done is
actually done. Removing null tests makes it more obscure what needs to be
done, because it means that the conditions under which a function needs to
be called (which may be different than the conditions under which it can
be called) are less apparent.

julia
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/