Bogus usage of tsleep(9) in USB.

John Polstra jdp at polstra.com
Fri Aug 20 09:06:58 PDT 2004


On 20-Aug-2004 Dag-Erling Smørgrav wrote:
> Pawel Jakub Dawidek <pjd at FreeBSD.org> writes:
>> There are many calls to tsleep(9) with no timeout in our USB code.
>> As you all know, it is not permitted and we have KASSERT() for this:
>>
>>         KASSERT(timo != 0 || mtx_owned(&Giant) || mtx != NULL,
>>             ("sleeping without a mutex"));
> 
> This panic message only applies to one of the three conditions the
> KASSERT tests.  It should probably be split into three separate
> KASSERTs with three different panic messages.

How would you do that?  Those are "||" operators, not "&&".  There
is only one way to fail:  by violating all three subconditions.

John


More information about the freebsd-current mailing list