[Devel] Re: [PATCH][NETNS] Use list_for_each_entry_continue_reverse in setup_net

Eric W. Biederman ebiederm at xmission.com
Fri Sep 14 14:53:21 PDT 2007


Stephen Hemminger <shemminger at linux-foundation.org> writes:

> Could we just make it so dev->init is not allowed to fail? Then it
> can be a void function and the nasty unwind code can go?

Unfortunately we need to allocate memory, and perform other operations
that can fail.  That's the nature of the problem.

So I think not allowing init to fail would be optimizing for the wrong
the case.  Allowing init to fail makes the rest of the code simpler
because we don't have to perform the impossible when the highly
unlikely happens.

The ugly unwind is only about 5 lines of code that never need to
change (except for beautification).  So I don't think the cost
is prohibitive.

Eric





More information about the Devel mailing list