netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bonding: simplify code and get rid of warning
@ 2008-02-19  5:04 Stephen Hemminger
  2008-02-20 16:57 ` Jay Vosburgh
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2008-02-19  5:04 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: bonding-devel, netdev

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.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
---
Patch against current 2.6.25 version.

--- a/drivers/net/bonding/bond_alb.c	2008-02-18 20:58:53.000000000 -0800
+++ b/drivers/net/bonding/bond_alb.c	2008-02-18 21:01:10.000000000 -0800
@@ -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) {

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

* Re: [PATCH] bonding: simplify code and get rid of warning
  2008-02-19  5:04 [PATCH] bonding: simplify code and get rid of warning Stephen Hemminger
@ 2008-02-20 16:57 ` Jay Vosburgh
  2008-02-20 17:24   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Jay Vosburgh @ 2008-02-20 16:57 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: bonding-devel, netdev

Stephen Hemminger <shemminger@vyatta.com> wrote:

>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, fubar@us.ibm.com


>Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>---
>Patch against current 2.6.25 version.
>
>--- a/drivers/net/bonding/bond_alb.c	2008-02-18 20:58:53.000000000 -0800
>+++ b/drivers/net/bonding/bond_alb.c	2008-02-18 21:01:10.000000000 -0800
>@@ -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 majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] bonding: simplify code and get rid of warning
  2008-02-20 16:57 ` Jay Vosburgh
@ 2008-02-20 17:24   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2008-02-20 17:24 UTC (permalink / raw)
  To: Jay Vosburgh; +Cc: bonding-devel, netdev

On Wed, 20 Feb 2008 08:57:56 -0800
Jay Vosburgh <fubar@us.ibm.com> wrote:

> Stephen Hemminger <shemminger@vyatta.com> wrote:
> 
> >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

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

end of thread, other threads:[~2008-02-20 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-19  5:04 [PATCH] bonding: simplify code and get rid of warning Stephen Hemminger
2008-02-20 16:57 ` Jay Vosburgh
2008-02-20 17:24   ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).