diff mbox series

[net-next] tcpv6: define th variable only once

Message ID 1582444614-6461-1-git-send-email-lirongqing@baidu.com
State Changes Requested
Delegated to: David Miller
Headers show
Series [net-next] tcpv6: define th variable only once | expand

Commit Message

Li RongQing Feb. 23, 2020, 7:56 a.m. UTC
to remove -Wshadow warning

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 net/ipv6/tcpv6_offload.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Feb. 24, 2020, 5:14 a.m. UTC | #1
From: Li RongQing <lirongqing@baidu.com>
Date: Sun, 23 Feb 2020 15:56:54 +0800

> @@ -51,7 +51,7 @@ static struct sk_buff *tcp6_gso_segment(struct sk_buff *skb,
>  
>  	if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
>  		const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
> -		struct tcphdr *th = tcp_hdr(skb);
> +		th = tcp_hdr(skb);
>  
>  		/* Set up pseudo header, usually expect stack to have done

This doesn't leave a new line before local variable declarations and
statements.

But even more interesting, is that the top level declaration of 'th'
can be removed the solve this warning and restricts the scope of 'th'
to where it is actually used.
diff mbox series

Patch

diff --git a/net/ipv6/tcpv6_offload.c b/net/ipv6/tcpv6_offload.c
index 1796856bc24f..8d9b31ef98bf 100644
--- a/net/ipv6/tcpv6_offload.c
+++ b/net/ipv6/tcpv6_offload.c
@@ -51,7 +51,7 @@  static struct sk_buff *tcp6_gso_segment(struct sk_buff *skb,
 
 	if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
 		const struct ipv6hdr *ipv6h = ipv6_hdr(skb);
-		struct tcphdr *th = tcp_hdr(skb);
+		th = tcp_hdr(skb);
 
 		/* Set up pseudo header, usually expect stack to have done
 		 * this.