Skip to content

Commit 444fa88

Browse files
cmetcalf-tileradavem330
authored andcommitted
net: tilegx driver: avoid compiler warning
The "id" variable was being incremented in common code, but only initialized and used in IPv4 code. We move the increment to the IPv4 code too, and then legitimately use the uninitialized_var() macro to avoid the gcc 4.6 warning that 'id' may be used uninitialized. Note that gcc 4.7 does not warn. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 04f0888 commit 444fa88

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/net/ethernet/tile/tilegx.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,7 +1734,8 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers,
17341734
unsigned int data_len = skb->len - sh_len;
17351735
unsigned char *data = skb->data;
17361736
unsigned int ih_off, th_off, p_len;
1737-
unsigned int isum_seed, tsum_seed, id, seq;
1737+
unsigned int isum_seed, tsum_seed, seq;
1738+
unsigned int uninitialized_var(id);
17381739
int is_ipv6;
17391740
long f_id = -1; /* id of the current fragment */
17401741
long f_size = skb_headlen(skb) - sh_len; /* current fragment size */
@@ -1781,7 +1782,7 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers,
17811782
} else {
17821783
ih = (struct iphdr *)(buf + ih_off);
17831784
ih->tot_len = htons(sh_len + p_len - ih_off);
1784-
ih->id = htons(id);
1785+
ih->id = htons(id++);
17851786
ih->check = csum_long(isum_seed + ih->tot_len +
17861787
ih->id) ^ 0xffff;
17871788
}
@@ -1818,7 +1819,6 @@ static void tso_headers_prepare(struct sk_buff *skb, unsigned char *headers,
18181819
slot++;
18191820
}
18201821

1821-
id++;
18221822
seq += p_len;
18231823

18241824
/* The last segment may be less than gso_size. */

0 commit comments

Comments
 (0)