On Fri, 2006-01-06 at 12:38 -0200, Alan Menegotto wrote: > Look at the code: > > static int __init ipv4_proc_init(void) > { > int rc = 0; > > if (raw_proc_init()) > goto out_raw; > if (tcp4_proc_init()) > goto out_tcp; > if (udp4_proc_init()) > goto out_udp; > if (fib_proc_init()) > goto out_fib; > if (ip_misc_proc_init()) > goto out_misc; > out: > return rc; > out_misc: > fib_proc_exit(); > out_fib: > udp4_proc_exit(); > out_udp: > tcp4_proc_exit(); > out_tcp: > raw_proc_exit(); > out_raw: > rc = -ENOMEM; > goto out; > } > > Calling tcp4_proc_init should go to label out_tcp, which call > raw_proc_exit(). Is this correct? If yes, why?
It's symmetric. If raw_proc_init() fails, no cleanup needs to be done so you go to out_raw. If tcp4_proc_init fails, then raw_proc_init() did *not* fail and needs to be cleaned up after by calling raw_proc_exit(). etc. johannes
signature.asc
Description: This is a digitally signed message part