On Sat, 15 Feb 2003, Matthew N. Dodd wrote: > On Fri, 14 Feb 2003, Nate Lawson wrote: > > Also, except for xl, all drivers have a common cleanup on error in > > attach that backs out allocated resources with no assumptions about the > > order they were allocated in. > > Please see if_pcn.c for the correct approach to freeing resources; its not > necessary to wrap evrything in 'if (sc && error != 0) {}'. If execution > reaches the 'fail' label then you assume that is what happened.
The 'if' is a matter of coding style. Which is preferred: multiple returns from the same function (one which is only reachable from a goto) or one linear path with an 'if' to see if this is an error exit? Regardless, the 'if (sc)' is necessary in ti.diff because the KLD_MODULE check at the beginning may goto fail before device_get_softc(). > I also think you should just drop and reaquire locks around the > bus_setup_intr() rather than moving code around. See the previous thread on this regarding my original dc(4) changes. It is bogus to create a lock with mtx_init and then immediately lock it for the entire attach routine just for the intention of ensuring exclusive access to the device. -Nate To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message