diff options
author | kaiw <kaiw@FreeBSD.org> | 2008-08-18 17:13:23 +0000 |
---|---|---|
committer | kaiw <kaiw@FreeBSD.org> | 2008-08-18 17:13:23 +0000 |
commit | 4f77677b6678d41bcbe4960cb156707d72af7a0e (patch) | |
tree | 2f81e542309dbe668f6dc9b0164eb9520a102bc3 | |
parent | 5e73cb432f2cbdced55c601db1d2b5dc20208360 (diff) | |
download | FreeBSD-src-4f77677b6678d41bcbe4960cb156707d72af7a0e.zip FreeBSD-src-4f77677b6678d41bcbe4960cb156707d72af7a0e.tar.gz |
sc->sc_ibuf should be malloc'ed after quirks applied, as
sc->sc_isize might have changed.
MFC after: 3 days
-rw-r--r-- | sys/dev/usb/ums.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c index 0e7d533..a869f75 100644 --- a/sys/dev/usb/ums.c +++ b/sys/dev/usb/ums.c @@ -362,12 +362,6 @@ ums_attach(device_t self) hid_input, &sc->sc_loc_btn[i-1], 0); sc->sc_isize = hid_report_size(desc, size, hid_input, &sc->sc_iid); - sc->sc_ibuf = malloc(sc->sc_isize, M_USB, M_NOWAIT); - if (!sc->sc_ibuf) { - printf("%s: no memory\n", device_get_nameunit(sc->sc_dev)); - free(sc->sc_loc_btn, M_USB); - return ENXIO; - } /* * The Microsoft Wireless Notebook Optical Mouse seems to be in worse @@ -410,6 +404,13 @@ ums_attach(device_t self) sc->sc_loc_btn[2].pos = 2; } + sc->sc_ibuf = malloc(sc->sc_isize, M_USB, M_NOWAIT); + if (!sc->sc_ibuf) { + printf("%s: no memory\n", device_get_nameunit(sc->sc_dev)); + free(sc->sc_loc_btn, M_USB); + return ENXIO; + } + sc->sc_ep_addr = ed->bEndpointAddress; sc->sc_disconnected = 0; free(desc, M_TEMP); |