Assert that si_threadcount > 0 before decrementing it. This helps catching

the improper use of the dev_refthread/dev_relthread.

Tested by:	pho
MFC after:	1 week
This commit is contained in:
kib 2008-05-23 16:38:38 +00:00
parent ad73989e21
commit c1c2996ed2

View File

@ -225,6 +225,8 @@ dev_relthread(struct cdev *dev)
mtx_assert(&devmtx, MA_NOTOWNED);
dev_lock();
KASSERT(dev->si_threadcount > 0,
("%s threadcount is wrong", dev->si_name));
dev->si_threadcount--;
dev_unlock();
}