Skip to content

Commit

Permalink
Staging: batman-adv: Avoid rounding issues for local hna timeout
Browse files Browse the repository at this point in the history
With the current default values, this patch is not critical, as
LOCAL_HNA_TIMEOUT is a multiple of 1000 anyway. However, if someone
would like to change this #define, the person could have some
unexpected rounding issues. Therefore doing the multiplication before
the division now.

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Linus Lüssing authored and Greg Kroah-Hartman committed Jul 8, 2010
1 parent 6e0e938 commit a14ca61
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/batman-adv/translation-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static void hna_local_purge(struct work_struct *work)
hna_local_entry = hashit.bucket->data;

timeout = hna_local_entry->last_seen +
((LOCAL_HNA_TIMEOUT / 1000) * HZ);
((LOCAL_HNA_TIMEOUT * HZ) / 1000);
if ((!hna_local_entry->never_purge) &&
time_after(jiffies, timeout))
hna_local_del(hna_local_entry, "address timed out");
Expand Down

0 comments on commit a14ca61

Please sign in to comment.