Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Move increments after evaluations.



details:   https://anonhg.NetBSD.org/src/rev/ee0b4347e6cb
branches:  trunk
changeset: 1027201:ee0b4347e6cb
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Dec 10 11:28:40 2021 +0000

description:
Move increments after evaluations.

  FreeBSD: dc11ba4eb3fe5cce615f361de83e85e07005ca24 or ix-3.3.14
  DPDK:    390445ec30b4c52a3d2887c3d2a202d9cf37ea8e

    The retry variable was being incremented before it was evaluated by the
    subsequent conditional against the maximum retries to figure out which
    message to print.  So we'll move the increment op to the end.

diffstat:

 sys/dev/pci/ixgbe/ixgbe_phy.c |  22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diffs (80 lines):

diff -r fb0da14f8a96 -r ee0b4347e6cb sys/dev/pci/ixgbe/ixgbe_phy.c
--- a/sys/dev/pci/ixgbe/ixgbe_phy.c     Fri Dec 10 11:27:17 2021 +0000
+++ b/sys/dev/pci/ixgbe/ixgbe_phy.c     Fri Dec 10 11:28:40 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_phy.c,v 1.25 2021/12/10 11:20:13 msaitoh Exp $ */
+/* $NetBSD: ixgbe_phy.c,v 1.26 2021/12/10 11:28:40 msaitoh Exp $ */
 
 /******************************************************************************
   SPDX-License-Identifier: BSD-3-Clause
@@ -36,7 +36,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_phy.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ixgbe_phy.c,v 1.25 2021/12/10 11:20:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe_phy.c,v 1.26 2021/12/10 11:28:40 msaitoh Exp $");
 
 #include "ixgbe_api.h"
 #include "ixgbe_common.h"
@@ -171,12 +171,12 @@
                ixgbe_i2c_bus_clear(hw);
                if (lock)
                        hw->mac.ops.release_swfw_sync(hw, swfw_mask);
-               retry++;
                if (retry < max_retry)
                        DEBUGOUT("I2C byte read combined error - Retrying.\n");
                else
                        DEBUGOUT("I2C byte read combined error.\n");
-       } while (retry < max_retry);
+               retry++;
+       } while (retry <= max_retry);
 
        return IXGBE_ERR_I2C;
 }
@@ -236,12 +236,12 @@
                ixgbe_i2c_bus_clear(hw);
                if (lock)
                        hw->mac.ops.release_swfw_sync(hw, swfw_mask);
-               retry++;
                if (retry < max_retry)
                        DEBUGOUT("I2C byte write combined error - Retrying.\n");
                else
                        DEBUGOUT("I2C byte write combined error.\n");
-       } while (retry < max_retry);
+               retry++;
+       } while (retry <= max_retry);
 
        return IXGBE_ERR_I2C;
 }
@@ -2137,13 +2137,13 @@
                        hw->mac.ops.release_swfw_sync(hw, swfw_mask);
                        msec_delay(100);
                }
-               retry++;
                if (retry < max_retry)
                        DEBUGOUT("I2C byte read error - Retrying.\n");
                else
                        DEBUGOUT("I2C byte read error.\n");
-
-       } while (retry < max_retry);
+               retry++;
+
+       } while (retry <= max_retry);
 
        return status;
 }
@@ -2241,12 +2241,12 @@
 
 fail:
                ixgbe_i2c_bus_clear(hw);
-               retry++;
                if (retry < max_retry)
                        DEBUGOUT("I2C byte write error - Retrying.\n");
                else
                        DEBUGOUT("I2C byte write error.\n");
-       } while (retry < max_retry);
+               retry++;
+       } while (retry <= max_retry);
 
        if (lock)
                hw->mac.ops.release_swfw_sync(hw, swfw_mask);



Home | Main Index | Thread Index | Old Index