summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/wlan/if_uath.c
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2013-02-08 21:15:47 +0000
committerhselasky <hselasky@FreeBSD.org>2013-02-08 21:15:47 +0000
commit6a11631ce88052548f4dca6d78cafcac473757ca (patch)
tree7b7783b99ff5976146ae2c097a46fbebc85fb20a /sys/dev/usb/wlan/if_uath.c
parentc03e3032d5b1c0469a386da4410584ebdaa8188a (diff)
downloadFreeBSD-src-6a11631ce88052548f4dca6d78cafcac473757ca.zip
FreeBSD-src-6a11631ce88052548f4dca6d78cafcac473757ca.tar.gz
Fix regression issue after r244503:
Correct init order to fix a NULL pointer access. MFC after: 1 week Reported by: Ian FREISLICH
Diffstat (limited to 'sys/dev/usb/wlan/if_uath.c')
-rw-r--r--sys/dev/usb/wlan/if_uath.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/dev/usb/wlan/if_uath.c b/sys/dev/usb/wlan/if_uath.c
index 0ac57af..37162c0 100644
--- a/sys/dev/usb/wlan/if_uath.c
+++ b/sys/dev/usb/wlan/if_uath.c
@@ -358,22 +358,12 @@ uath_attach(device_t dev)
callout_init(&sc->stat_ch, 0);
callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0);
- /*
- * Allocate xfers for firmware commands.
- */
- error = uath_alloc_cmd_list(sc, sc->sc_cmd);
- if (error != 0) {
- device_printf(sc->sc_dev,
- "could not allocate Tx command list\n");
- goto fail;
- }
-
error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer,
uath_usbconfig, UATH_N_XFERS, sc, &sc->sc_mtx);
if (error) {
device_printf(dev, "could not allocate USB transfers, "
"err=%s\n", usbd_errstr(error));
- goto fail1;
+ goto fail;
}
sc->sc_cmd_dma_buf =
@@ -382,6 +372,16 @@ uath_attach(device_t dev)
usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_BULK_TX], 0);
/*
+ * Setup buffers for firmware commands.
+ */
+ error = uath_alloc_cmd_list(sc, sc->sc_cmd);
+ if (error != 0) {
+ device_printf(sc->sc_dev,
+ "could not allocate Tx command list\n");
+ goto fail1;
+ }
+
+ /*
* We're now ready to send+receive firmware commands.
*/
UATH_LOCK(sc);
@@ -492,8 +492,8 @@ uath_attach(device_t dev)
fail4: if_free(ifp);
fail3: UATH_UNLOCK(sc);
-fail2: usbd_transfer_unsetup(sc->sc_xfer, UATH_N_XFERS);
-fail1: uath_free_cmd_list(sc, sc->sc_cmd);
+fail2: uath_free_cmd_list(sc, sc->sc_cmd);
+fail1: usbd_transfer_unsetup(sc->sc_xfer, UATH_N_XFERS);
fail:
return (error);
}
OpenPOWER on IntegriCloud