svn commit: r253831 - head/sys/dev/usb/wlan

Rui Paulo rpaulo at FreeBSD.org
Wed Jul 31 06:05:35 UTC 2013


Author: rpaulo
Date: Wed Jul 31 06:05:34 2013
New Revision: 253831
URL: http://svnweb.freebsd.org/changeset/base/253831

Log:
  Cleanup the allocations when the attachment fails.

Modified:
  head/sys/dev/usb/wlan/if_rsu.c

Modified: head/sys/dev/usb/wlan/if_rsu.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rsu.c	Wed Jul 31 05:52:03 2013	(r253830)
+++ head/sys/dev/usb/wlan/if_rsu.c	Wed Jul 31 06:05:34 2013	(r253831)
@@ -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);
 }
 


More information about the svn-src-head mailing list