Date: Wed, 31 Jul 2013 06:05:35 +0000 (UTC) From: Rui Paulo <rpaulo@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r253831 - head/sys/dev/usb/wlan Message-ID: <201307310605.r6V65ZEk032078@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307310605.r6V65ZEk032078>