public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix style changes reported by cppcheck
@ 2011-10-30 15:36 Simon Wunderlich
  2011-10-30 20:24 ` Marek Lindner
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Wunderlich @ 2011-10-30 15:36 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Simon Wunderlich

cppcheck reported some style issues this patch fixes.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
---
 bat_iv_ogm.c     |    2 +-
 routing.c        |    2 +-
 soft-interface.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bat_iv_ogm.c b/bat_iv_ogm.c
index 3512e25..17b6dfa 100644
--- a/bat_iv_ogm.c
+++ b/bat_iv_ogm.c
@@ -990,7 +990,6 @@ static void bat_ogm_process(const struct ethhdr *ethhdr,
 
 	if (is_my_orig) {
 		unsigned long *word;
-		int offset;
 
 		orig_neigh_node = get_orig_node(bat_priv, ethhdr->h_source);
 		if (!orig_neigh_node)
@@ -1002,6 +1001,7 @@ static void bat_ogm_process(const struct ethhdr *ethhdr,
 		if (has_directlink_flag &&
 		    compare_eth(if_incoming->net_dev->dev_addr,
 				batman_ogm_packet->orig)) {
+			int offset;
 			offset = if_incoming->if_num * NUM_WORDS;
 
 			spin_lock_bh(&orig_neigh_node->ogm_cnt_lock);
diff --git a/routing.c b/routing.c
index ef24a72..3e97c2c 100644
--- a/routing.c
+++ b/routing.c
@@ -977,7 +977,6 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if)
 	struct unicast_frag_packet *unicast_packet;
 	int hdr_size = sizeof(*unicast_packet);
 	struct sk_buff *new_skb = NULL;
-	int ret;
 
 	if (check_unicast_packet(skb, hdr_size) < 0)
 		return NET_RX_DROP;
@@ -989,6 +988,7 @@ int recv_ucast_frag_packet(struct sk_buff *skb, struct hard_iface *recv_if)
 
 	/* packet for me */
 	if (is_my_mac(unicast_packet->dest)) {
+		int ret;
 
 		ret = frag_reassemble_skb(skb, bat_priv, &new_skb);
 
diff --git a/soft-interface.c b/soft-interface.c
index 45297c8..3ed6781 100644
--- a/soft-interface.c
+++ b/soft-interface.c
@@ -692,7 +692,6 @@ void interface_rx(struct net_device *soft_iface,
 	struct vlan_ethhdr *vhdr;
 	struct softif_neigh *curr_softif_neigh = NULL;
 	short vid = -1;
-	int ret;
 
 	/* check if enough space is available for pulling, and pull */
 	if (!pskb_may_pull(skb, hdr_size))
@@ -722,6 +721,7 @@ void interface_rx(struct net_device *soft_iface,
 	 */
 	curr_softif_neigh = softif_neigh_vid_get_selected(bat_priv, vid);
 	if (curr_softif_neigh) {
+		int ret;
 		skb_push(skb, hdr_size);
 		unicast_packet = (struct unicast_packet *)skb->data;
 
-- 
1.7.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix style changes reported by cppcheck
  2011-10-30 15:36 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix style changes reported by cppcheck Simon Wunderlich
@ 2011-10-30 20:24 ` Marek Lindner
  2011-10-30 20:58   ` Simon Wunderlich
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Lindner @ 2011-10-30 20:24 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Sunday, October 30, 2011 16:36:20 Simon Wunderlich wrote:
> cppcheck reported some style issues this patch fixes.
> 
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
>  bat_iv_ogm.c     |    2 +-
>  routing.c        |    2 +-
>  soft-interface.c |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

Do you mind saying what cppcheck reported ?
What happened to patch 2/2 ?

Regards,
Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix style changes reported by cppcheck
  2011-10-30 20:24 ` Marek Lindner
@ 2011-10-30 20:58   ` Simon Wunderlich
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Wunderlich @ 2011-10-30 20:58 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 1094 bytes --]

Hey,

Patch 2/2 was created accidently due to my lack of git skills, please
assume [PATCH]. :)

The output of cppcheck (before the applying the patch): 

$ cppcheck -q --enable=all .
[bat_iv_ogm.c:993]: (style) The scope of the variable 'offset' can be reduced
[routing.c:980]: (style) The scope of the variable 'ret' can be reduced
[soft-interface.c:695]: (style) The scope of the variable 'ret' can be reduced

Note that reduced scope may be a matter of taste, I could not really find
anything about that in the CodingStyle.

Cheers
	Simon


On Sun, Oct 30, 2011 at 09:24:31PM +0100, Marek Lindner wrote:
> On Sunday, October 30, 2011 16:36:20 Simon Wunderlich wrote:
> > cppcheck reported some style issues this patch fixes.
> > 
> > Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> > ---
> >  bat_iv_ogm.c     |    2 +-
> >  routing.c        |    2 +-
> >  soft-interface.c |    2 +-
> >  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> Do you mind saying what cppcheck reported ?
> What happened to patch 2/2 ?
> 
> Regards,
> Marek
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-30 20:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-30 15:36 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Fix style changes reported by cppcheck Simon Wunderlich
2011-10-30 20:24 ` Marek Lindner
2011-10-30 20:58   ` Simon Wunderlich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox