Commit d5c7d7f6 authored by Asaf Vertz's avatar Asaf Vertz Committed by Jeff Kirsher

e1000: fix time comparison

To be future-proof and for better readability the time comparisons are
modified to use time_after_eq() instead of plain, error-prone math.
Signed-off-by: default avatarAsaf Vertz <asaf.vertz@tandemg.com>
Acked-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: default avatarAaron Brown <aaron.f.brown@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 0c490874
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
/* ethtool support for e1000 */ /* ethtool support for e1000 */
#include "e1000.h" #include "e1000.h"
#include <linux/jiffies.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
enum {NETDEV_STATS, E1000_STATS}; enum {NETDEV_STATS, E1000_STATS};
...@@ -1460,7 +1461,7 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter) ...@@ -1460,7 +1461,7 @@ static int e1000_run_loopback_test(struct e1000_adapter *adapter)
ret_val = 13; /* ret_val is the same as mis-compare */ ret_val = 13; /* ret_val is the same as mis-compare */
break; break;
} }
if (jiffies >= (time + 2)) { if (time_after_eq(jiffies, time + 2)) {
ret_val = 14; /* error code for time out error */ ret_val = 14; /* error code for time out error */
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment