From bc3552517bdf59d271e7209c4fbf5af42696f3fc Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Tue, 14 Jun 2005 17:47:31 +0000 Subject: [PATCH] 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 Reported by: submitter, le, dougb Approved by: re (ifnet blanket) --- sys/dev/if_ndis/if_ndis.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index a9e960c3f4b5..25045927d1df 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -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;