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:
Konstantin Belousov 2008-05-23 16:38:38 +00:00
parent 772e245341
commit 06fe11294d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=179248

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();
}