public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] mic_virtio: fix a timeout loop
@ 2015-12-15 10:11 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-12-15 10:11 UTC (permalink / raw)
  To: linux-kernel, Sudeep Dutt, Ashutosh Dixit
  Cc: kernel-janitors, Greg Kroah-Hartman

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>

diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c
index e486a0c..b3ad9c4 100644
--- a/drivers/misc/mic/card/mic_virtio.c
+++ b/drivers/misc/mic/card/mic_virtio.c
@@ -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);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-12-15 10:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-15 10:11 [patch] mic_virtio: fix a timeout loop Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox