summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-09-16 09:20:58 +0000
committerru <ru@FreeBSD.org>2005-09-16 09:20:58 +0000
commit985e35fdbaafacb128246b9c324b47382c1c525c (patch)
tree8b7a01cbb3e8eacf8697d0f292b60270e161bb4e /sys
parentec39fdd014992d715023513c3f467183fe1ad7cb (diff)
downloadFreeBSD-src-985e35fdbaafacb128246b9c324b47382c1c525c.zip
FreeBSD-src-985e35fdbaafacb128246b9c324b47382c1c525c.tar.gz
Add missing mtx_destroy() when if_alloc() fails.
Add missing if_free() when mii_phy_probe() fails. Put if_free() into the correct #ifdef in detach().
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/if_aue.c7
-rw-r--r--sys/dev/usb/if_axe.c7
-rw-r--r--sys/dev/usb/if_cdce.c2
-rw-r--r--sys/dev/usb/if_cue.c6
-rw-r--r--sys/dev/usb/if_kue.c6
-rw-r--r--sys/dev/usb/if_udav.c3
6 files changed, 27 insertions, 4 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)
diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c
index 349c917..65d10c3 100644
--- a/sys/dev/usb/if_axe.c
+++ b/sys/dev/usb/if_axe.c
@@ -485,6 +485,10 @@ USB_ATTACH(axe)
ifp = sc->axe_ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
printf("axe%d: can not if_alloc()\n", sc->axe_unit);
+ AXE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
+ mtx_destroy(&sc->axe_mtx);
+#endif
USB_ATTACH_ERROR_RETURN;
}
ifp->if_softc = sc;
@@ -505,6 +509,7 @@ USB_ATTACH(axe)
if (mii_phy_probe(self, &sc->axe_miibus,
axe_ifmedia_upd, axe_ifmedia_sts)) {
printf("axe%d: MII without any PHY!\n", sc->axe_unit);
+ if_free(ifp);
AXE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
mtx_destroy(&sc->axe_mtx);
@@ -545,9 +550,9 @@ axe_detach(device_ptr_t dev)
untimeout(axe_tick, sc, sc->axe_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->axe_ep[AXE_ENDPT_TX] != NULL)
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index b44b299..c738272 100644
--- a/sys/dev/usb/if_cdce.c
+++ b/sys/dev/usb/if_cdce.c
@@ -286,6 +286,8 @@ USB_ATTACH(cdce)
ifp = GET_IFP(sc) = if_alloc(IFT_ETHER);
if (ifp == NULL) {
printf("%s: can not if_alloc()\n", USBDEVNAME(sc->cdce_dev));
+ CDCE_UNLOCK(sc);
+ mtx_destroy(&sc->cdce_mtx);
USB_ATTACH_ERROR_RETURN;
}
ifp->if_softc = sc;
diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c
index e597051..0d6ce71 100644
--- a/sys/dev/usb/if_cue.c
+++ b/sys/dev/usb/if_cue.c
@@ -505,6 +505,10 @@ USB_ATTACH(cue)
ifp = sc->cue_ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
printf("cue%d: can not if_alloc()\n", sc->cue_unit);
+ CUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
+ mtx_destroy(&sc->cue_mtx);
+#endif
USB_ATTACH_ERROR_RETURN;
}
ifp->if_softc = sc;
@@ -552,9 +556,9 @@ cue_detach(device_ptr_t dev)
untimeout(cue_tick, sc, sc->cue_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->cue_ep[CUE_ENDPT_TX] != NULL)
diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c
index f8c9d95..7c5a700 100644
--- a/sys/dev/usb/if_kue.c
+++ b/sys/dev/usb/if_kue.c
@@ -478,6 +478,10 @@ USB_ATTACH(kue)
ifp = sc->kue_ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
printf("kue%d: can not if_alloc()\n", sc->kue_unit);
+ KUE_UNLOCK(sc);
+#if __FreeBSD_version >= 500000
+ mtx_destroy(&sc->kue_mtx);
+#endif
USB_ATTACH_ERROR_RETURN;
}
ifp->if_softc = sc;
@@ -526,9 +530,9 @@ kue_detach(device_ptr_t dev)
if (ifp != NULL)
#if __FreeBSD_version >= 500000
ether_ifdetach(ifp);
+ if_free(ifp);
#else
ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
- if_free(ifp);
#endif
if (sc->kue_ep[KUE_ENDPT_TX] != NULL)
diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c
index 690c9de..cd09046 100644
--- a/sys/dev/usb/if_udav.c
+++ b/sys/dev/usb/if_udav.c
@@ -378,6 +378,7 @@ USB_ATTACH(udav)
splx(s);
#elif defined(__FreeBSD__)
UDAV_UNLOCK(sc);
+ mtx_destroy(&sc->sc_mtx);
#endif
goto bad;
}
@@ -391,6 +392,7 @@ USB_ATTACH(udav)
if (ifp == NULL) {
printf("%s: can not if_alloc\n", devname);
UDAV_UNLOCK(sc);
+ mtx_destroy(&sc->sc_mtx);
goto bad;
}
#else
@@ -447,6 +449,7 @@ USB_ATTACH(udav)
if (mii_phy_probe(self, &sc->sc_miibus,
udav_ifmedia_change, udav_ifmedia_status)) {
printf("%s: MII without any PHY!\n", USBDEVNAME(sc->sc_dev));
+ if_free(ifp);
UDAV_UNLOCK(sc);
mtx_destroy(&sc->sc_mtx);
USB_ATTACH_ERROR_RETURN;
OpenPOWER on IntegriCloud