Skip to contentSkip to conversation

: Don't initialize err variable twice.

PATCH Applied Pavel Emelyanov 3 participants 3 messages Apr 21, 2008 – Apr 23, 2008

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

PATCH 1/1 : Don't initialize err variable twice.

The ip6_route_net_init() performs some unneeded actions.

---

net/ipv6/route.c +1 -1
index 210a079..7f82e80 100644
@@ -2614,7 +2614,7 @@ struct ctl_table *ipv6_route_sysctl_init(struct net *net)
 
 static int ip6_route_net_init(struct net *net)
 {
-	int ret = 0;
+	int ret;
 
 	ret = -ENOMEM;
 	net->ipv6.ip6_dst_ops = kmemdup(&ip6_dst_ops_template,
maintainer Applied
#1 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Mon, 21 Apr 2008 17:07:53 +0400

Quoted 3 lines

The ip6_route_net_init() performs some unneeded actions.

Applied, except that I put the initialization with the variable declaration to save screen real-estate when people look at this code :-) Like so:

commit 633d424bf33dab99e77b36210fbd1b996e7823df

Author: Pavel Emelyanov <[email protected]>
Date:   Mon Apr 21 14:25:23 2008 -0700

[NETNS]: Don't initialize err variable twice.

The ip6_route_net_init() performs some unneeded actions.

net/ipv6/route.c +1 -2
index 1f42bc9..a493ad9 100644
@@ -2614,9 +2614,8 @@ struct ctl_table *ipv6_route_sysctl_init(struct net *net)
 
 static int ip6_route_net_init(struct net *net)
 {
-	int ret = 0;
+	int ret = -ENOMEM;
 
-	ret = -ENOMEM;
 	net->ipv6.ip6_dst_ops = kmemdup(&ip6_dst_ops_template,
 					sizeof(*net->ipv6.ip6_dst_ops),
 					GFP_KERNEL);