Date: Mon, 9 Jan 2017 23:42:03 +0000 (UTC) From: Andriy Voskoboinyk <avos@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r311838 - head/sys/dev/rtwn/usb Message-ID: <201701092342.v09Ng32n050702@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avos Date: Mon Jan 9 23:42:02 2017 New Revision: 311838 URL: https://svnweb.freebsd.org/changeset/base/311838 Log: rtwn_usb(4): do not try to modify global static structure. Use a local copy for modifications instead. Tested with RTL8821AU (AP) + RTL8188EU (STA). Reported by: hselasky Modified: head/sys/dev/rtwn/usb/rtwn_usb_ep.c Modified: head/sys/dev/rtwn/usb/rtwn_usb_ep.c ============================================================================== --- head/sys/dev/rtwn/usb/rtwn_usb_ep.c Mon Jan 9 23:41:10 2017 (r311837) +++ head/sys/dev/rtwn/usb/rtwn_usb_ep.c Mon Jan 9 23:42:02 2017 (r311838) @@ -58,7 +58,7 @@ __FBSDID("$FreeBSD$"); #include <dev/rtwn/rtl8192c/usb/r92cu_reg.h> -static struct usb_config rtwn_config[RTWN_N_TRANSFER] = { +static const struct usb_config rtwn_config_common[RTWN_N_TRANSFER] = { [RTWN_BULK_RX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -161,6 +161,7 @@ rtwn_usb_setup_queues(struct rtwn_usb_so int rtwn_usb_setup_endpoints(struct rtwn_usb_softc *uc) { + struct usb_config *rtwn_config; struct rtwn_softc *sc = &uc->uc_sc; const uint8_t iface_index = RTWN_IFACE_INDEX; struct usb_endpoint *ep, *ep_end; @@ -197,6 +198,9 @@ rtwn_usb_setup_endpoints(struct rtwn_usb return (EINVAL); } + rtwn_config = malloc(sizeof(rtwn_config_common), M_TEMP, M_WAITOK); + memcpy(rtwn_config, rtwn_config_common, sizeof(rtwn_config_common)); + /* NB: keep in sync with rtwn_dma_init(). */ rtwn_config[RTWN_BULK_TX_VO].endpoint = addr[0]; switch (uc->ntx) { @@ -224,6 +228,8 @@ rtwn_usb_setup_endpoints(struct rtwn_usb rtwn_config[RTWN_BULK_RX].bufsize = sc->rx_dma_size + 1024; error = usbd_transfer_setup(uc->uc_udev, &iface_index, uc->uc_xfer, rtwn_config, RTWN_N_TRANSFER, uc, &sc->sc_mtx); + free(rtwn_config, M_TEMP); + if (error) { device_printf(sc->sc_dev, "could not allocate USB transfers, " "err=%s\n", usbd_errstr(error));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701092342.v09Ng32n050702>