VFIO: platform: reset: fix a warning message condition
Subsystems (4)
PATCH 1/1 VFIO: platform: reset: fix a warning message condition
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.
drivers/vfio/platform/reset/vfio_platform_amdxgbe.c +1 -1
@@ -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)
Hi Dan,
thanks for pointing this out.
I add Thomas in CC since the bug also exists in the native driver I think (drivers/net/ethernet/amd/xgbe/drivers/net/ethernet/amd/xgbe /xgbe-dev.c, xgbe_exit function).
Best Regards
Eric
Quoted 21 lines · Dan Carpenter
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 <[email protected]>drivers/vfio/platform/reset/vfio_platform_amdxgbe.c +1
-1@@ -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)
Quoted 4 lines · Eric Auger
I add Thomas in CC since the bug also exists in the native driver I think (
drivers/net/ethernet/amd/xgbe/drivers/net/ethernet/amd/xgbe/xgbe-dev.c,xgbe_exitfunction).
Thanks, but I sent a patch for that one already. (These are static checker fixes).
regards,
dan carpenter
Alex Williamson
AppliedQuoted 8 lines · Dan Carpenter
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 <[email protected]>
Applied to next for v4.5 with Eric's Reviewed-by. Thanks!
Alex
Quoted 17 lines
drivers/vfio/platform/reset/vfio_platform_amdxgbe.c +0
-0@@ -110,7 +110,7 @@ int vfio_platform_amdxgbe_reset(struct vfio_platform_device *vdev) usleep_range(10, 15);
count = 2000;drivers/vfio/platform/reset/vfio_platform_amdxgbe.c +0
-1- while (count-- && (ioread32(xgmac_regs->ioaddr + DMA_MR) &1))
drivers/vfio/platform/reset/vfio_platform_amdxgbe.c +1
-0+ while (--count && (ioread32(xgmac_regs->ioaddr + DMA_MR) &1))
usleep_range(500, 600);
if (!count)