Version 3 of the Quote Of The Day driver defines two constants to make sure the mutex and condition variable are destroyed when the driver is finished with them. The driver uses these constants to set and reset the new flags member of the device state structure.
The QOTD_DIDMUTEX flag is set in the qotd_attach() entry point immediately after a successful call to mutex_init(9F). If the QOTD_DIDMUTEX flag is set when the qotd_detach() entry point is called, the qotd_detach() entry point calls the mutex_destroy(9F) function.
The QOTD_DIDCV flag is set in the qotd_attach() entry point immediately after a successful call to cv_init(9F). If the QOTD_DIDCV flag is set when the qotd_detach() entry point is called, the qotd_detach() entry point calls the cv_destroy(9F) function.