Skip to content

Commit

Permalink
benet: Use time_before_eq for time comparison
Browse files Browse the repository at this point in the history
Use time_before_eq for time comparison more safe and dealing
with timer wrapping to be future-proof.

Signed-off-by: Karim Eshapa <karim.eshapa@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
karimeshapaLinux authored and davem330 committed May 1, 2017
1 parent 1a7fca6 commit 2faf265
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/emulex/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5268,15 +5268,15 @@ static bool be_err_is_recoverable(struct be_adapter *adapter)
dev_err(&adapter->pdev->dev, "Recoverable HW error code: 0x%x\n",
ue_err_code);

if (jiffies - err_rec->probe_time <= initial_idle_time) {
if (time_before_eq(jiffies - err_rec->probe_time, initial_idle_time)) {
dev_err(&adapter->pdev->dev,
"Cannot recover within %lu sec from driver load\n",
jiffies_to_msecs(initial_idle_time) / MSEC_PER_SEC);
return false;
}

if (err_rec->last_recovery_time &&
(jiffies - err_rec->last_recovery_time <= recovery_interval)) {
if (err_rec->last_recovery_time && time_before_eq(
jiffies - err_rec->last_recovery_time, recovery_interval)) {
dev_err(&adapter->pdev->dev,
"Cannot recover within %lu sec from last recovery\n",
jiffies_to_msecs(recovery_interval) / MSEC_PER_SEC);
Expand Down

0 comments on commit 2faf265

Please sign in to comment.