Commit 00972bcd authored by Dan Carpenter's avatar Dan Carpenter Committed by Willy Tarreau

USB: ipaq.c: fix a timeout loop

commit abdc9a3b upstream.

The code expects the loop to end with "retries" set to zero but, because
it is a post-op, it will end set to -1.  I have fixed this by moving the
decrement inside the loop.

Fixes: 014aa2a3 ('USB: ipaq: minor ipaq_open() cleanup.')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
(cherry picked from commit 53a68d3f)
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent 22a1caa0
...@@ -663,8 +663,8 @@ static int ipaq_open(struct tty_struct *tty, ...@@ -663,8 +663,8 @@ static int ipaq_open(struct tty_struct *tty,
* through. Since this has a reasonably high failure rate, we retry * through. Since this has a reasonably high failure rate, we retry
* several times. * several times.
*/ */
while (retries) {
while (retries--) { retries--;
result = usb_control_msg(serial->dev, result = usb_control_msg(serial->dev,
usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21, usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
0x1, 0, NULL, 0, 100); 0x1, 0, NULL, 0, 100);
......
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