Skip to contentSkip to conversation

VFIO: platform: reset: fix a warning message condition

PATCH Applied Dan Carpenter 3 participants 4 messages Dec 17, 2015 – Dec 22, 2015

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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.

Fixes 0990822c9866 ('VFIO: platform: reset: AMD xgbe reset module')
drivers/vfio/platform/reset/vfio_platform_amdxgbe.c +1 -1
index da5356f..d4030d0 100644
@@ -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)
Reviewed-by on v1 1/1
#1 lore raw

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')
drivers/vfio/platform/reset/vfio_platform_amdxgbe.c +1 -1
index da5356f..d4030d0 100644
@@ -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)
#2 lore raw
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_exit function).

Thanks, but I sent a patch for that one already. (These are static checker fixes).

regards,
dan carpenter

#3 lore raw
In reply to Dan Carpenter
Quoted 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')

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
index da5356f..d4030d0 100644
@@ -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)