diff options
author | scottl <scottl@FreeBSD.org> | 2005-07-07 01:05:45 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2005-07-07 01:05:45 +0000 |
commit | 5b31b99954daa585036b676ec1e9271df6ab4fa7 (patch) | |
tree | 679bf8cbc973b2674f52dbcb43f710c9f537ec4a /sys/pci | |
parent | 253af4de5559542d22963cabf36415592e477638 (diff) | |
download | FreeBSD-src-5b31b99954daa585036b676ec1e9271df6ab4fa7.zip FreeBSD-src-5b31b99954daa585036b676ec1e9271df6ab4fa7.tar.gz |
Fix ifnet fallout in if_ti.
Reviewed by: brooks
Approved by: re
Diffstat (limited to 'sys/pci')
-rw-r--r-- | sys/pci/if_ti.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sys/pci/if_ti.c b/sys/pci/if_ti.c index b6a3a7f..1bbfe38 100644 --- a/sys/pci/if_ti.c +++ b/sys/pci/if_ti.c @@ -2062,10 +2062,17 @@ ti_attach(dev) sc = device_get_softc(dev); unit = device_get_unit(dev); + sc->ti_unit = unit; mtx_init(&sc->ti_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); ifmedia_init(&sc->ifmedia, IFM_IMASK, ti_ifmedia_upd, ti_ifmedia_sts); + ifp = sc->ti_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + printf("ti%d: can not if_alloc()\n", sc->ti_unit); + error = ENOSPC; + goto fail; + } sc->ti_ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; sc->ti_ifp->if_capenable = sc->ti_ifp->if_capabilities; @@ -2101,8 +2108,6 @@ ti_attach(dev) goto fail; } - sc->ti_unit = unit; - if (ti_chipinit(sc)) { printf("ti%d: chip initialization failed\n", sc->ti_unit); error = ENXIO; @@ -2222,12 +2227,6 @@ ti_attach(dev) sc->ti_tx_buf_ratio = 21; /* Set up ifnet structure */ - ifp = sc->ti_ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) { - printf("ti%d: can not if_alloc()\n", sc->ti_unit); - error = ENOSPC; - goto fail; - } ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST | |