Writing Device Drivers

_fini(9E)

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(9E), the driver should release any resources that were allocated in _init() and must remove itself from the system module list.