summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/if_aue.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/if_aue.c')
-rw-r--r--sys/dev/usb/if_aue.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 5112d7b..4793c4d 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -715,6 +715,10 @@ USB_ATTACH(aue)
ifp = sc->aue_ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
printf("aue%d: can not if_alloc()\n", sc->aue_unit);
+ AUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
+ mtx_destroy(&sc->aue_mtx);
+#endif
USB_ATTACH_ERROR_RETURN;
}
ifp->if_softc = sc;
@@ -745,6 +749,7 @@ USB_ATTACH(aue)
if (mii_phy_probe(self, &sc->aue_miibus,
aue_ifmedia_upd, aue_ifmedia_sts)) {
printf("aue%d: MII without any PHY!\n", sc->aue_unit);
+ if_free(ifp);
AUE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
mtx_destroy(&sc->aue_mtx);
@@ -785,9 +790,9 @@ aue_detach(device_ptr_t dev)
untimeout(aue_tick, sc, sc->aue_stat_ch);
#if __FreeBSD_version >= 500000
ether_ifdetach(ifp);
+ if_free(ifp);
#else
ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
- if_free(ifp);
#endif
if (sc->aue_ep[AUE_ENDPT_TX] != NULL)
OpenPOWER on IntegriCloud