Initialize the sysctl_ctx list early, which avoids a panic in case other

allocatiosn fail and fxp_release() is called.
This commit is contained in:
Jonathan Lemon 2002-01-22 17:51:44 +00:00
parent 81c9105585
commit a1a9c8f7e6

View file

@ -359,6 +359,7 @@ fxp_attach(device_t dev)
bzero(sc, sizeof(*sc));
sc->dev = dev;
callout_handle_init(&sc->stat_ch);
sysctl_ctx_init(&sc->sysctl_ctx);
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE);
s = splimp();
@ -480,7 +481,6 @@ fxp_attach(device_t dev)
/*
* Create the sysctl tree
*/
sysctl_ctx_init(&sc->sysctl_ctx);
sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO,
device_get_nameunit(dev), CTLFLAG_RD, 0, "");