PERFORCE change 160655 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Wed Apr 15 05:59:11 PDT 2009
http://perforce.freebsd.org/chv.cgi?CH=160655
Change 160655 by hselasky at hselasky_laptop001 on 2009/04/15 12:59:06
USB CORE: Fix possible issue with clear-stall and set-config happening
at the same time.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/usb_device.c#25 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/usb_device.c#25 (text+ko) ====
@@ -724,22 +724,33 @@
goto done;
}
}
- udev->pipes_max = ep_max;
- udev->pipes = NULL;
- if (udev->pipes_max != 0) {
- udev->pipes = malloc(sizeof(*pipe) * udev->pipes_max,
+ if (ep_max != 0) {
+ udev->pipes = malloc(sizeof(*pipe) * ep_max,
M_USB, M_WAITOK | M_ZERO);
if (udev->pipes == NULL) {
err = USB_ERR_NOMEM;
goto done;
}
+ } else {
+ udev->pipes = NULL;
}
+ USB_BUS_LOCK(udev->bus);
+ udev->pipes_max = ep_max;
+ /* reset any ongoing clear-stall */
+ udev->pipe_curr = NULL;
+ USB_BUS_UNLOCK(udev->bus);
}
done:
if (err) {
if (cmd == USB_CFG_ALLOC) {
cleanup:
+ USB_BUS_LOCK(udev->bus);
+ udev->pipes_max = 0;
+ /* reset any ongoing clear-stall */
+ udev->pipe_curr = NULL;
+ USB_BUS_UNLOCK(udev->bus);
+
/* cleanup */
if (udev->ifaces != NULL)
free(udev->ifaces, M_USB);
@@ -749,7 +760,6 @@
udev->ifaces = NULL;
udev->pipes = NULL;
udev->ifaces_max = 0;
- udev->pipes_max = 0;
}
}
return (err);
More information about the p4-projects
mailing list