Commit 73fa6d3f authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] USB: Small fixes for usbtest

It fixes a few minor problems in the usbtest driver:

	Unlinks are done in the expected order, preventing some
	inappropriate error messages.

	The driver would wait for an URB to complete, even if the URB
	got an error on submission.

	There was a surprising memory leak: the driver didn't kfree()
	its private data structure.
parent cfe44e6e
......@@ -695,8 +695,9 @@ static void ctrl_complete (struct urb *urb, struct pt_regs *regs)
*/
/* unlink whatever's still pending */
for (i = 0; i < ctx->param->sglen; i++) {
struct urb *u = ctx->urb [i];
for (i = 1; i < ctx->param->sglen; i++) {
struct urb *u = ctx->urb [
(i + subcase->number) % ctx->param->sglen];
if (u == urb || !u->dev)
continue;
......@@ -893,7 +894,8 @@ test_ctrl_queue (struct usbtest_dev *dev, struct usbtest_param *param)
/* FIXME set timer and time out; provide a disconnect hook */
/* wait for the last one to complete */
wait_for_completion (&context.complete);
if (context.pending > 0)
wait_for_completion (&context.complete);
cleanup:
for (i = 0; i < param->sglen; i++) {
......@@ -1374,6 +1376,7 @@ static void usbtest_disconnect (struct usb_interface *intf)
usb_set_intfdata (intf, NULL);
info ("unbound %s", dev->id);
kfree (dev);
}
/* Basic testing only needs a device that can source or sink bulk traffic.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment