[Cocci] s390/net: Deletion of unnecessary checks before two function calls

Julia Lawall julia.lawall at lip6.fr
Mon Nov 3 18:02:14 CET 2014

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


More information about the Cocci mailing list