Commit 824d752b04765fc513fe17666a539f6c73960c4e

Authored by Roger Quadros
Committed by Greg Kroah-Hartman
1 parent e5e4746510

usb: usbtest: Always clear halt else further tests will fail

In test_halt() we set an endpoint halt condition and return on halt verification
failure, then the enpoint will remain halted and all further tests related
to that enpoint will fail. This is because we don't tackle endpoint halt error condition
in any of the tests. To avoid that situation, make sure to clear the
halt condition before exiting test_halt().

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 10 additions and 1 deletions Side-by-side Diff

drivers/usb/misc/usbtest.c
... ... @@ -1554,8 +1554,17 @@
1554 1554 return retval;
1555 1555 }
1556 1556 retval = verify_halted(tdev, ep, urb);
1557   - if (retval < 0)
  1557 + if (retval < 0) {
  1558 + int ret;
  1559 +
  1560 + /* clear halt anyways, else further tests will fail */
  1561 + ret = usb_clear_halt(urb->dev, urb->pipe);
  1562 + if (ret)
  1563 + ERROR(tdev, "ep %02x couldn't clear halt, %d\n",
  1564 + ep, ret);
  1565 +
1558 1566 return retval;
  1567 + }
1559 1568  
1560 1569 /* clear halt (tests API + protocol), verify it worked */
1561 1570 retval = usb_clear_halt(urb->dev, urb->pipe);