Make sure qwx(4) always calls refcnt_init() before other refcnt functions.
authorstsp <stsp@openbsd.org>
Tue, 11 Jun 2024 10:06:35 +0000 (10:06 +0000)
committerstsp <stsp@openbsd.org>
Tue, 11 Jun 2024 10:06:35 +0000 (10:06 +0000)
commit9032038bb3b0771c4b92980121fdb12a0718e868
treecc093cd6d5d3e8d35bba5737b51ee46a3ad78d45
parentef3dc0dcc1138b6ce6d1baaa8544cb908412cc24
Make sure qwx(4) always calls refcnt_init() before other refcnt functions.

I recently enabled automatic recovery from firmware crashes. if loading
firmware at boot would fail with a firmware error then the init task would
call refcnt_finalize() via qwx_stop() before refcnt_init() was called and
trigger a KASSERT in the refcnt code.

ok patrick@, who also reported the problem to me and tested the fix
sys/dev/ic/qwx.c
sys/dev/pci/if_qwx_pci.c