Fix cam_sim_free() wakeup condition and add mtx_asserts.

Submitted by:	Christoph Mallon
Reviewed by:	scottl
Approved by:	rwatson (mentor)
Sponsored by:	FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2008-12-19 14:33:29 +00:00
parent 24ebf56636
commit 7412d60d0b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186320

View File

@ -123,9 +123,10 @@ void
cam_sim_release(struct cam_sim *sim)
{
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
mtx_assert(sim->mtx, MA_OWNED);
sim->refcount--;
if (sim->refcount <= 1)
if (sim->refcount == 0)
wakeup(sim);
}
@ -133,6 +134,7 @@ void
cam_sim_hold(struct cam_sim *sim)
{
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
mtx_assert(sim->mtx, MA_OWNED);
sim->refcount++;
}