Skip to contentSkip to conversation

bonding: simplify code and get rid of warning

PATCH In review Stephen Hemminger 2 participants 3 messages Feb 19, 2008 – Feb 20, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bonding: simplify code and get rid of warning

Get rid of warning and simplify code that looks up vlan tag. No need to get tag, then copy it. Also no need for a local status variable.

---
Patch against current 2.6.25 version.

drivers/net/bonding/bond_alb.c +1 -5
@@ -678,12 +678,8 @@ static struct slave *rlb_choose_channel(
 		}
 
 		if (!list_empty(&bond->vlan_list)) {
-			unsigned short vlan_id;
-			int res = vlan_get_tag(skb, &vlan_id);
-			if (!res) {
+			if (!vlan_get_tag(skb, &client_info->vlan_id))
 				client_info->tag = 1;
-				client_info->vlan_id = vlan_id;
-			}
 		}
 
 		if (!client_info->assigned) {
#1 lore raw
Quoted 3 lines · Stephen Hemminger

Get rid of warning and simplify code that looks up vlan tag. No need to get tag, then copy it. Also no need for a local status variable.

Granted, the current code is suboptimal, but I don't see any
warnings compiling this (gcc 4.1.2). What are you getting?

	-J

---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]

Quoted 24 lines

---
Patch against current 2.6.25 version.

drivers/net/bonding/bond_alb.c +1 -6
@@ -678,12 +678,8 @@ static struct slave *rlb_choose_channel(
 		}
 
 		if (!list_empty(&bond->vlan_list)) {
-			unsigned short vlan_id;
-			int res = vlan_get_tag(skb, &vlan_id);
-			if (!res) {
+			if (!vlan_get_tag(skb, &client_info->vlan_id))
 				client_info->tag = 1;
-				client_info->vlan_id = vlan_id;
-			}
 		}
 
 		if (!client_info->assigned) {
--

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 9 lines · On Wed, 20 Feb 2008 08:57:56 -0800 Jay Vosburgh <[email protected]> wrote:
Quoted 3 lines · Stephen Hemminger

Get rid of warning and simplify code that looks up vlan tag. No need to get tag, then copy it. Also no need for a local status variable.

Granted, the current code is suboptimal, but I don't see any
warnings compiling this (gcc 4.1.2). What are you getting?

Gcc 4.2.3
CC [M] drivers/net/bonding/bond_main.o
drivers/net/bonding/bond_main.c: In function ‘bond_dev_queue_xmit’:
drivers/net/bonding/bond_main.c:386: warning: ‘vlan_id’ may be used uninitialized in this function
CC [M] drivers/net/bonding/bond_3ad.o
CC [M] drivers/net/bonding/bond_alb.o
drivers/net/bonding/bond_alb.c: In function ‘rlb_choose_channel’:
drivers/net/bonding/bond_alb.c:681: warning: ‘vlan_id’ may be used uninitialized in this function
CC [M] drivers/net/bonding/bond_sysfs.o