Move if_alloc() higher in the attach function so sc->ifp is populated

early.  I've moved it all the way to the top rather than part way up as
the submitter did.

Submitted by:	Jung-uk Kim <jkim at niksun dot com>
Reported by:	submitter, le, dougb
Approved by:	re (ifnet blanket)
This commit is contained in:
Brooks Davis 2005-06-14 17:47:31 +00:00
parent 5b9f3a50a0
commit bc3552517b

View File

@ -467,6 +467,12 @@ ndis_attach(dev)
int i;
sc = device_get_softc(dev);
ifp = sc->ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
error = ENOSPC;
goto fail;
}
ifp->if_softc = sc;
mtx_init(&sc->ndis_mtx, "ndis softc lock",
MTX_NETWORK_LOCK, MTX_DEF);
@ -612,12 +618,6 @@ ndis_attach(dev)
/* Check for task offload support. */
ndis_probe_offload(sc);
ifp = sc->ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
error = ENOSPC;
goto fail;
}
ifp->if_softc = sc;
if_initname(ifp, device_get_name(dev), device_get_unit(dev));
ifp->if_mtu = ETHERMTU;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;