The following example demonstrates the _fini() routine.
int _fini(void) { int error; error = mod_remove(&modlinkage); if (error != 0) { return (error); } /* * Cleanup resources allocated in _init() */ ddi_soft_state_fini(&xxstatep); return (0); }
Similarly, in _fini(), the driver should release any resources that were allocated in _init(). The driver must remove itself from the system module list.