summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrpaulo <rpaulo@FreeBSD.org>2013-07-31 06:05:34 +0000
committerrpaulo <rpaulo@FreeBSD.org>2013-07-31 06:05:34 +0000
commitff87088d16c5dbd932c4c0da73845b43357adb07 (patch)
tree0a27989dd7f05359471a6b136327cc10280ccc8b
parent349cc93fd1bc1e103b41591ba6ee331f1eafd34f (diff)
downloadFreeBSD-src-ff87088d16c5dbd932c4c0da73845b43357adb07.zip
FreeBSD-src-ff87088d16c5dbd932c4c0da73845b43357adb07.tar.gz
Cleanup the allocations when the attachment fails.
-rw-r--r--sys/dev/usb/wlan/if_rsu.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c
index ab905fe..30cdbe9 100644
--- a/sys/dev/usb/wlan/if_rsu.c
+++ b/sys/dev/usb/wlan/if_rsu.c
@@ -323,7 +323,7 @@ rsu_attach(device_t self)
device_printf(sc->sc_dev,
"could not allocate USB transfers, err=%s\n",
usbd_errstr(error));
- goto detach;
+ goto fail_usb;
}
RSU_LOCK(sc);
/* Read chip revision. */
@@ -333,7 +333,7 @@ rsu_attach(device_t self)
error = rsu_read_rom(sc);
if (error != 0) {
device_printf(self, "could not read ROM\n");
- goto detach;
+ goto fail_rom;
}
RSU_UNLOCK(sc);
IEEE80211_ADDR_COPY(sc->sc_bssid, &sc->rom[0x12]);
@@ -341,7 +341,7 @@ rsu_attach(device_t self)
ifp = sc->sc_ifp = if_alloc(IFT_IEEE80211);
if (ifp == NULL) {
device_printf(self, "cannot allocate interface\n");
- goto detach;
+ goto fail_ifalloc;
}
ic = ifp->if_l2com;
ifp->if_softc = sc;
@@ -407,8 +407,11 @@ rsu_attach(device_t self)
return (0);
-detach:
- rsu_detach(self);
+fail_ifalloc:
+fail_rom:
+ usbd_transfer_unsetup(sc->sc_xfer, RSU_N_TRANSFER);
+fail_usb:
+ mtx_destroy(&sc->sc_mtx);
return (ENXIO);
}
OpenPOWER on IntegriCloud