VFIO: platform: reset: fix a warning message condition
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 17 Dec 2015 12:27:07 +0000 (15:27 +0300)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 21 Dec 2015 22:28:11 +0000 (15:28 -0700)
This loop ends with count set to -1 and not zero so the warning message
isn't printed when it should be.  I've fixed this by change the postop
to a preop.

Fixes: 0990822c9866 ('VFIO: platform: reset: AMD xgbe reset module')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/platform/reset/vfio_platform_amdxgbe.c

index da5356f48d0b023225e62a672716e24d1ee94550..d4030d0c38e9c69b6498ed45624df5884ef8c003 100644 (file)
@@ -110,7 +110,7 @@ int vfio_platform_amdxgbe_reset(struct vfio_platform_device *vdev)
        usleep_range(10, 15);
 
        count = 2000;
-       while (count-- && (ioread32(xgmac_regs->ioaddr + DMA_MR) & 1))
+       while (--count && (ioread32(xgmac_regs->ioaddr + DMA_MR) & 1))
                usleep_range(500, 600);
 
        if (!count)