diff mbox series

[v2] net: ipv6: remove unused local variable

Message ID 20210715042034.6525-1-rocco.yue@mediatek.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [v2] net: ipv6: remove unused local variable | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Rocco Yue July 15, 2021, 4:20 a.m. UTC
The local variable "struct net *net" in the two functions of
inet6_rtm_getaddr() and inet6_dump_addr() are actually useless,
so remove them.

Signed-off-by: Rocco Yue <rocco.yue@mediatek.com>
---
 net/ipv6/addrconf.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

David Ahern July 15, 2021, 2:16 p.m. UTC | #1
On 7/14/21 10:20 PM, Rocco Yue wrote:
> The local variable "struct net *net" in the two functions of
> inet6_rtm_getaddr() and inet6_dump_addr() are actually useless,
> so remove them.
> 
> Signed-off-by: Rocco Yue <rocco.yue@mediatek.com>
> ---
>  net/ipv6/addrconf.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 

a v2 with no changelog. From what I can tell the only difference is
"net: " in the Subject line which is not what I said in the last email.

Let me try again: There are 2 trees - net for bug fixes and net-next for
development (anything that is not a bug fix). Each patch should specify
which tree the patch is for by putting 'net' or 'net-next' in the
brackets ([]). This is a cleanup not a bug fix, so this patch should be:

[PATCH net-next] ipv6: remove unused local variable

and really that should be

[PATCH net-next] ipv6: remove unnecessary local variable

If you send more versions of a patch always put a changelog - a summary
of what is different in the current patch versus the previous ones.

No need to send another version of this patch unless you get a comment
requesting change, or the maintainers ask for a re-send.

Reviewed-by: David Ahern <dsahern@kernel.org>
Rocco Yue July 15, 2021, 2:19 p.m. UTC | #2
On Thu, 2021-07-15 at 08:16 -0600, David Ahern wrote:
> On 7/14/21 10:20 PM, Rocco Yue wrote:
>> The local variable "struct net *net" in the two functions of
>> inet6_rtm_getaddr() and inet6_dump_addr() are actually useless,
>> so remove them.
>> 
>> Signed-off-by: Rocco Yue <rocco.yue@mediatek.com>
>> ---
>>  net/ipv6/addrconf.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>> 
> 
> a v2 with no changelog. From what I can tell the only difference is
> "net: " in the Subject line which is not what I said in the last email.
> 
> Let me try again: There are 2 trees - net for bug fixes and net-next for
> development (anything that is not a bug fix). Each patch should specify
> which tree the patch is for by putting 'net' or 'net-next' in the
> brackets ([]). This is a cleanup not a bug fix, so this patch should be:
> 
> [PATCH net-next] ipv6: remove unused local variable
> 
> and really that should be
> 
> [PATCH net-next] ipv6: remove unnecessary local variable
> 
> If you send more versions of a patch always put a changelog - a summary
> of what is different in the current patch versus the previous ones.
> 
> No need to send another version of this patch unless you get a comment
> requesting change, or the maintainers ask for a re-send.
> 
> Reviewed-by: David Ahern <dsahern@kernel.org>

Hi David,

Thanks for your detailed explanation,
I am appreciated that you shared these valureable advices for me.
They are important for my furture upstream work.
I will re-send it :)

Sincerely,
Rocco
diff mbox series

Patch

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 3bf685fe64b9..e2f625e39455 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5211,8 +5211,7 @@  static int inet6_dump_addr(struct sk_buff *skb, struct netlink_callback *cb,
 		.netnsid = -1,
 		.type = type,
 	};
-	struct net *net = sock_net(skb->sk);
-	struct net *tgt_net = net;
+	struct net *tgt_net = sock_net(skb->sk);
 	int idx, s_idx, s_ip_idx;
 	int h, s_h;
 	struct net_device *dev;
@@ -5351,7 +5350,7 @@  static int inet6_rtm_valid_getaddr_req(struct sk_buff *skb,
 static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 			     struct netlink_ext_ack *extack)
 {
-	struct net *net = sock_net(in_skb->sk);
+	struct net *tgt_net = sock_net(in_skb->sk);
 	struct inet6_fill_args fillargs = {
 		.portid = NETLINK_CB(in_skb).portid,
 		.seq = nlh->nlmsg_seq,
@@ -5359,7 +5358,6 @@  static int inet6_rtm_getaddr(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 		.flags = 0,
 		.netnsid = -1,
 	};
-	struct net *tgt_net = net;
 	struct ifaddrmsg *ifm;
 	struct nlattr *tb[IFA_MAX+1];
 	struct in6_addr *addr = NULL, *peer;