浏览代码

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>
Roger Quadros 11 年之前
父节点
当前提交
824d752b04
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      drivers/usb/misc/usbtest.c

+ 10 - 1
drivers/usb/misc/usbtest.c

@@ -1554,8 +1554,17 @@ static int test_halt(struct usbtest_dev *tdev, int ep, struct urb *urb)
 		return retval;
 		return retval;
 	}
 	}
 	retval = verify_halted(tdev, ep, urb);
 	retval = verify_halted(tdev, ep, urb);
-	if (retval < 0)
+	if (retval < 0) {
+		int ret;
+
+		/* clear halt anyways, else further tests will fail */
+		ret = usb_clear_halt(urb->dev, urb->pipe);
+		if (ret)
+			ERROR(tdev, "ep %02x couldn't clear halt, %d\n",
+			      ep, ret);
+
 		return retval;
 		return retval;
+	}
 
 
 	/* clear halt (tests API + protocol), verify it worked */
 	/* clear halt (tests API + protocol), verify it worked */
 	retval = usb_clear_halt(urb->dev, urb->pipe);
 	retval = usb_clear_halt(urb->dev, urb->pipe);