Skip to contentSkip to conversation

batman-adv: Avoid relation operator comparison with bool

PATCH In review Sven Eckelmann 2 participants 2 messages Feb 20, 2018 Batman advanced

lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

PATCH 1/1 batman-adv: Avoid relation operator comparison with bool

commit 34b3c3850e7d ("batman-adv: Distributed ARP Table - create DHT helper functions") introduced a return check of batadv_compare_eth which uses a boolean return value since commit 16af73458aca ("batman-adv: main, batadv_compare_eth return bool"). A relational (<, >, <= or >=) operator is not the right one for such a check.

---
Cc: David Binderman <[email protected]>
Cc: Antonio Quartulli <[email protected]>
Cc: Markus Pargmann <[email protected]>

---
 net/batman-adv/distributed-arp-table.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/distributed-arp-table.c +1 -1
index 760c0de7..a39a07d6 100644
@@ -493,7 +493,7 @@ static bool batadv_is_orig_node_eligible(struct batadv_dat_candidate *res,
 	 * the one with the lowest address
 	 */
 	if (tmp_max == max && max_orig_node &&
-	    batadv_compare_eth(candidate->orig, max_orig_node->orig) > 0)
+	    batadv_compare_eth(candidate->orig, max_orig_node->orig))
 		goto out;
 
 	ret = true;
Signature · 1 line
2.11.0
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Sven Eckelmann

commit 34b3c3850e7d ("batman-adv: Distributed ARP Table - create DHT helper functions") introduced a return check of batadv_compare_eth which uses a boolean return value since commit 16af73458aca ("batman-adv: main, batadv_compare_eth return bool"). A relational (<, >, <= or >=) operator is not the right one for such a check.

Quoted 7 lines

---
Cc: David Binderman <[email protected]>
Cc: Antonio Quartulli <[email protected]>
Cc: Markus Pargmann <[email protected]>
---

Signature · 1 line
Antonio Quartulli