mic_virtio: fix a timeout loop
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 15 Dec 2015 10:11:28 +0000 (13:11 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 8 Feb 2016 06:53:40 +0000 (22:53 -0800)
After the loop we test "if (!retry)" to see if we timedout.  The problem
is "retry--" is a post-op so retry will be -1 at the end of the loop.  I
have fixed this by changing it to a pre-op instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mic/card/mic_virtio.c

index f6ed57d3125c753e6abe42838f2c6bbf9a407c82..17764b2fbee59fd2c8e3b682900cb5920835e87e 100644 (file)
@@ -337,7 +337,7 @@ static int mic_find_vqs(struct virtio_device *vdev, unsigned nvqs,
         * rings have been re-assigned.
         */
        mic_send_intr(mvdev->mdev, mvdev->c2h_vdev_db);
-       for (retry = 100; retry--;) {
+       for (retry = 100; --retry;) {
                if (!ioread8(&dc->used_address_updated))
                        break;
                msleep(100);