Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

batman-adv: don't use !! in bool conversion

In C standard any expression different from 0 will be converted to
'true' when casting to bool (whatever is the length of the value).
Therefore all the "!!" conversions can be removed.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>

+5 -5
+2 -2
net/batman-adv/translation-table.c
··· 902 902 /* remove address from local hash if present */ 903 903 local_flags = batadv_tt_local_remove(bat_priv, tt_addr, 904 904 "global tt received", 905 - !!(flags & BATADV_TT_CLIENT_ROAM)); 905 + flags & BATADV_TT_CLIENT_ROAM); 906 906 tt_global_entry->common.flags |= local_flags & BATADV_TT_CLIENT_WIFI; 907 907 908 908 if (!(flags & BATADV_TT_CLIENT_ROAM)) ··· 2515 2515 if (!tt_global_entry) 2516 2516 goto out; 2517 2517 2518 - ret = !!(tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM); 2518 + ret = tt_global_entry->common.flags & BATADV_TT_CLIENT_ROAM; 2519 2519 batadv_tt_global_entry_free_ref(tt_global_entry); 2520 2520 out: 2521 2521 return ret;
+3 -3
net/batman-adv/unicast.c
··· 122 122 { 123 123 struct batadv_frag_packet_list_entry *tfp; 124 124 struct batadv_unicast_frag_packet *tmp_up = NULL; 125 - int is_head_tmp, is_head; 125 + bool is_head_tmp, is_head; 126 126 uint16_t search_seqno; 127 127 128 128 if (up->flags & BATADV_UNI_FRAG_HEAD) ··· 130 130 else 131 131 search_seqno = ntohs(up->seqno)-1; 132 132 133 - is_head = !!(up->flags & BATADV_UNI_FRAG_HEAD); 133 + is_head = up->flags & BATADV_UNI_FRAG_HEAD; 134 134 135 135 list_for_each_entry(tfp, head, list) { 136 136 if (!tfp->skb) ··· 142 142 tmp_up = (struct batadv_unicast_frag_packet *)tfp->skb->data; 143 143 144 144 if (tfp->seqno == search_seqno) { 145 - is_head_tmp = !!(tmp_up->flags & BATADV_UNI_FRAG_HEAD); 145 + is_head_tmp = tmp_up->flags & BATADV_UNI_FRAG_HEAD; 146 146 if (is_head_tmp != is_head) 147 147 return tfp; 148 148 else