sc->sc_ibuf should be malloc'ed after quirks applied, as

sc->sc_isize might have changed.

MFC after:   3 days
This commit is contained in:
kaiw 2008-08-18 17:13:23 +00:00
parent 5e73cb432f
commit 4f77677b66

View File

@ -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);