Skip to contentSkip to conversation

batman-adv: checkpatch - else is not generally useful after a break or return

PATCH Applied Antonio Quartulli 2 participants 10 messages Sep 1, 2014 – Nov 1, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 batman-adv: checkpatch - else is not generally useful after a break or return

---
 bitarray.h          | 3 +--
 fragmentation.h     | 3 +--
 network-coding.c    | 3 +--
 translation-table.c | 5 ++---
 4 files changed, 5 insertions(+), 9 deletions(-)
bitarray.h +1 -2
index cc24073..2acaafe 100644
@@ -29,8 +29,7 @@ static inline int batadv_test_bit(const unsigned long *seq_bits,
 	diff = last_seqno - curr_seqno;
 	if (diff < 0 || diff >= BATADV_TQ_LOCAL_WINDOW_SIZE)
 		return 0;
-	else
-		return test_bit(diff, seq_bits) != 0;
+	return test_bit(diff, seq_bits) != 0;
 }
 
 /* turn corresponding bit on, so we can remember that we got the packet */
fragmentation.h +1 -2
index 5d7a0e6..d848cf6 100644
@@ -41,8 +41,7 @@ batadv_frag_check_entry(struct batadv_frag_table_entry *frags_entry)
 	if (!hlist_empty(&frags_entry->head) &&
 	    batadv_has_timed_out(frags_entry->timestamp, BATADV_FRAG_TIMEOUT))
 		return true;
-	else
-		return false;
+	return false;
 }
 
 #endif /* _NET_BATMAN_ADV_FRAGMENTATION_H_ */
network-coding.c +1 -2
index 8d04d17..bd33894 100644
@@ -1212,8 +1212,7 @@ static bool batadv_nc_skb_coding_possible(struct sk_buff *skb,
 {
 	if (BATADV_SKB_CB(skb)->decoded && !batadv_compare_eth(dst, src))
 		return false;
-	else
-		return true;
+	return true;
 }
 
 /**
translation-table.c +2 -3
index 5f59e7f..38a804e 100644
@@ -2769,9 +2769,8 @@ static bool batadv_send_tt_response(struct batadv_priv *bat_priv,
 {
 	if (batadv_is_my_mac(bat_priv, req_dst))
 		return batadv_send_my_tt_response(bat_priv, tt_data, req_src);
-	else
-		return batadv_send_other_tt_response(bat_priv, tt_data,
-						     req_src, req_dst);
+	return batadv_send_other_tt_response(bat_priv, tt_data, req_src,
+					     req_dst);
 }
 
 static void _batadv_tt_update_changes(struct batadv_priv *bat_priv,
Signature · 1 line
1.8.5.5
#1 lore raw

PATCH 2/5 batman-adv: checkpatch - No space is necessary after a cast

---
 main.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
main.h +4 -4
index 4c557eb..52cb007 100644
@@ -313,10 +313,10 @@ static inline bool batadv_has_timed_out(unsigned long timestamp,
  *  - when adding 128 - it is neither a predecessor nor a successor,
  *  - after adding more than 127 to the starting value - it is a successor
  */
-#define batadv_seq_before(x, y) ({typeof(x) _d1 = (x); \
-				 typeof(y) _d2 = (y); \
-				 typeof(x) _dummy = (_d1 - _d2); \
-				 (void) (&_d1 == &_d2); \
+#define batadv_seq_before(x, y) ({typeof(x)_d1 = (x); \
+				 typeof(y)_d2 = (y); \
+				 typeof(x)_dummy = (_d1 - _d2); \
+				 (void)(&_d1 == &_d2); \
 				 _dummy > batadv_smallest_signed_int(_dummy); })
 #define batadv_seq_after(x, y) batadv_seq_before(y, x)
 
Signature · 1 line
1.8.5.5
#2 lore raw

Re: [B.A.T.M.A.N.] [PATCH 2/5] batman-adv: checkpatch - No space is necessary after a cast

Quoted 4 lines · On Monday 01 September 2014 14:37:26 Antonio Quartulli wrote:
---
 main.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied in revision b32044a.

Thanks,
Marek

#3 lore raw

PATCH 3/5 batman-adv: checkpatch - Please use a blank line after declarations

In reply to Antonio Quartulli
---
 debugfs.c               | 1 +
 distributed-arp-table.c | 1 +
 gateway_client.c        | 1 +
 packet.h                | 1 +
 4 files changed, 4 insertions(+)
debugfs.c +1 -0
index a12e25e..d9b9a8e 100644
@@ -405,6 +405,7 @@ struct batadv_debuginfo batadv_hardif_debuginfo_##_name = {	\
 		.release = single_release,			\
 	},							\
 }
+
 static BATADV_HARDIF_DEBUGINFO(originators, S_IRUGO,
 			       batadv_originators_hardif_open);
 
distributed-arp-table.c +1 -0
index b598111..aad022d 100644
@@ -1100,6 +1100,7 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
 	batadv_dat_send_data(bat_priv, skb, ip_src, BATADV_P_DAT_DHT_PUT);
 	batadv_dat_send_data(bat_priv, skb, ip_dst, BATADV_P_DAT_DHT_PUT);
 }
+
 /**
  * batadv_dat_snoop_incoming_arp_reply - snoop the ARP reply and fill the local
  * DAT storage only
gateway_client.c +1 -0
index 90cff58..bcc3e0c 100644
@@ -775,6 +775,7 @@ batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len,
 
 	return ret;
 }
+
 /**
  * batadv_gw_out_of_range - check if the dhcp request destination is the best gw
  * @bat_priv: the bat priv with all the soft interface information
packet.h +1 -0
index 34e096d..facd1fe 100644
@@ -198,6 +198,7 @@ struct batadv_bla_claim_dst {
 	uint8_t type;		/* bla_claimframe */
 	__be16 group;		/* group id */
 };
+
 #pragma pack()
 
 /**
Signature · 1 line
1.8.5.5
#4 lore raw

Re: [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: checkpatch - Please use a blank line after declarations

Quoted 7 lines · On Monday 01 September 2014 14:37:27 Antonio Quartulli wrote:
---
 debugfs.c               | 1 +
 distributed-arp-table.c | 1 +
 gateway_client.c        | 1 +
 packet.h                | 1 +
 4 files changed, 4 insertions(+)

Applied in revision 55c2fe7.

Thanks,
Marek

#5 lore raw

PATCH 4/5 batman-adv: checkpatch - Please don't use multiple blank lines

In reply to Antonio Quartulli
---
 bat_iv_ogm.c            | 2 --
 bitarray.c              | 1 -
 bridge_loop_avoidance.c | 7 -------
 fragmentation.c         | 1 -
 main.c                  | 1 -
 originator.c            | 1 -
 originator.h            | 1 -
 routing.c               | 1 -
 soft-interface.c        | 1 -
 sysfs.c                 | 1 -
 translation-table.c     | 1 -
 11 files changed, 18 deletions(-)
bat_iv_ogm.c +0 -2
index 73209f3..4dd7c40 100644
@@ -26,7 +26,6 @@
 #include "bat_algo.h"
 #include "network-coding.h"
 
-
 /**
  * enum batadv_dup_status - duplicate status
  * @BATADV_NO_DUP: the packet is a duplicate
@@ -1362,7 +1361,6 @@ out:
 	return ret;
 }
 
-
 /**
  * batadv_iv_ogm_process_per_outif - process a batman iv OGM for an outgoing if
  * @skb: the skb containing the OGM
bitarray.c +0 -1
index 9586750..e3da07a 100644
@@ -29,7 +29,6 @@ static void batadv_bitmap_shift_left(unsigned long *seq_bits, int32_t n)
 	bitmap_shift_left(seq_bits, seq_bits, n, BATADV_TQ_LOCAL_WINDOW_SIZE);
 }
 
-
 /* receive and process one packet within the sequence number window.
  *
  * returns:
bridge_loop_avoidance.c +0 -7
index 0f0ca43..4fc6cab 100644
@@ -69,7 +69,6 @@ static inline uint32_t batadv_choose_backbone_gw(const void *data,
 	return hash % size;
 }
 
-
 /* compares address and vid of two backbone gws */
 static int batadv_compare_backbone_gw(const struct hlist_node *node,
 				      const void *data2)
@@ -662,7 +661,6 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv,
 	if (unlikely(!backbone_gw))
 		return 1;
 
-
 	/* handle as ANNOUNCE frame */
 	backbone_gw->lasttime = jiffies;
 	crc = ntohs(*((__be16 *)(&an_addr[4])));
@@ -849,7 +847,6 @@ static int batadv_check_claim_group(struct batadv_priv *bat_priv,
 	return 2;
 }
 
-
 /**
  * batadv_bla_process_claim
  * @bat_priv: the bat priv with all the soft interface information
@@ -1347,8 +1344,6 @@ out:
 	return ret;
 }
 
-
-
 /**
  * batadv_bla_is_backbone_gw_orig
  * @bat_priv: the bat priv with all the soft interface information
@@ -1390,7 +1385,6 @@ bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, uint8_t *orig,
 	return false;
 }
 
-
 /**
  * batadv_bla_is_backbone_gw
  * @skb: the frame to be checked
@@ -1480,7 +1474,6 @@ int batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
 	if (!atomic_read(&bat_priv->bridge_loop_avoidance))
 		goto allow;
 
-
 	if (unlikely(atomic_read(&bat_priv->bla.num_requests)))
 		/* don't allow broadcasts while requests are in flight */
 		if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast)
fragmentation.c +0 -1
index 022d18a..022156d 100644
@@ -23,7 +23,6 @@
 #include "hard-interface.h"
 #include "soft-interface.h"
 
-
 /**
  * batadv_frag_clear_chain - delete entries in the fragment buffer chain
  * @head: head of chain with entries.
main.c +0 -1
index 2cdd25a..d4079cd 100644
@@ -41,7 +41,6 @@
 #include "network-coding.h"
 #include "fragmentation.h"
 
-
 /* List manipulations on hardif_list have to be rtnl_lock()'ed,
  * list traversals just rcu-locked
  */
originator.c +0 -1
index 6a48451..6c65c54 100644
@@ -799,7 +799,6 @@ batadv_purge_orig_ifinfo(struct batadv_priv *bat_priv,
 	return ifinfo_purged;
 }
 
-
 /**
  * batadv_purge_orig_neighbors - purges neighbors from originator
  * @bat_priv: the bat priv with all the soft interface information
originator.h +0 -1
index db3a9ed..aa4a436 100644
@@ -70,7 +70,6 @@ batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node,
 			  unsigned short vid);
 void batadv_orig_node_vlan_free_ref(struct batadv_orig_node_vlan *orig_vlan);
 
-
 /* hashfunction to choose an entry in a hash table of given size
  * hash algorithm from http://en.wikipedia.org/wiki/Hash_table
  */
routing.c +0 -1
index 35f76f2..3a6764d 100644
@@ -292,7 +292,6 @@ out:
 	return ret;
 }
 
-
 int batadv_recv_icmp_packet(struct sk_buff *skb,
 			    struct batadv_hard_iface *recv_if)
 {
soft-interface.c +0 -1
index 9bf382d..ea80e6d 100644
@@ -36,7 +36,6 @@
 #include "bridge_loop_avoidance.h"
 #include "network-coding.h"
 
-
 static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd);
 static void batadv_get_drvinfo(struct net_device *dev,
 			       struct ethtool_drvinfo *info);
sysfs.c +0 -1
index fc47baa..a63c3eb 100644
@@ -151,7 +151,6 @@ ssize_t batadv_show_##_name(struct kobject *kobj,			\
 	static BATADV_ATTR(_name, _mode, batadv_show_##_name,		\
 			   batadv_store_##_name)
 
-
 #define BATADV_ATTR_SIF_STORE_UINT(_name, _min, _max, _post_func)	\
 ssize_t batadv_store_##_name(struct kobject *kobj,			\
 			     struct attribute *attr, char *buff,	\
translation-table.c +0 -1
index 38a804e..84e6f01 100644
@@ -1780,7 +1780,6 @@ static void batadv_tt_global_del(struct batadv_priv *bat_priv,
 		batadv_tt_global_del_roaming(bat_priv, tt_global_entry,
 					     orig_node, message);
 
-
 out:
 	if (tt_global_entry)
 		batadv_tt_global_entry_free_ref(tt_global_entry);
Signature · 1 line
1.8.5.5
#6 lore raw

Re: [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: checkpatch - Please don't use multiple blank lines

Quoted 14 lines · On Monday 01 September 2014 14:37:28 Antonio Quartulli wrote:
---
 bat_iv_ogm.c            | 2 --
 bitarray.c              | 1 -
 bridge_loop_avoidance.c | 7 -------
 fragmentation.c         | 1 -
 main.c                  | 1 -
 originator.c            | 1 -
 originator.h            | 1 -
 routing.c               | 1 -
 soft-interface.c        | 1 -
 sysfs.c                 | 1 -
 translation-table.c     | 1 -
 11 files changed, 18 deletions(-)

Applied in revision 873d798.

Thanks,
Marek

#7 lore raw

PATCH 5/5 batman-adv: checkpatch - remove unnecessary parentheses

In reply to Antonio Quartulli
---
 bat_iv_ogm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bat_iv_ogm.c +2 -2
index 4dd7c40..00e00e0 100644
@@ -878,7 +878,7 @@ batadv_iv_ogm_slide_own_bcast_window(struct batadv_hard_iface *hard_iface)
 		hlist_for_each_entry_rcu(orig_node, head, hash_entry) {
 			spin_lock_bh(&orig_node->bat_iv.ogm_cnt_lock);
 			word_index = hard_iface->if_num * BATADV_NUM_WORDS;
-			word = &(orig_node->bat_iv.bcast_own[word_index]);
+			word = &orig_node->bat_iv.bcast_own[word_index];
 
 			batadv_bit_get_packet(bat_priv, word, 1, 0);
 			if_num = hard_iface->if_num;
@@ -1663,7 +1663,7 @@ static void batadv_iv_ogm_process(const struct sk_buff *skb, int ogm_offset,
 			offset = if_num * BATADV_NUM_WORDS;
 
 			spin_lock_bh(&orig_neigh_node->bat_iv.ogm_cnt_lock);
-			word = &(orig_neigh_node->bat_iv.bcast_own[offset]);
+			word = &orig_neigh_node->bat_iv.bcast_own[offset];
 			bit_pos = if_incoming_seqno - 2;
 			bit_pos -= ntohl(ogm_packet->seqno);
 			batadv_set_bit(word, bit_pos);
Signature · 1 line
1.8.5.5
#8 lore raw

Re: [B.A.T.M.A.N.] [PATCH 5/5] batman-adv: checkpatch - remove unnecessary parentheses

Quoted 4 lines · On Monday 01 September 2014 14:37:29 Antonio Quartulli wrote:
---
 bat_iv_ogm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied in revision dac27f8.

Thanks,
Marek