Skip to contentSkip to conversation

Cleanup snmp6_alloc_dev()

PATCH Applied Pavel Emelyanov 2 participants 2 messages Oct 17, 2007 – Oct 18, 2007

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

PATCH 1/1 Cleanup snmp6_alloc_dev()

This functions is never called with NULL or not setup argument, so the checks inside are redundant.

Also, the return value is always -ENOMEM, so no need in additional variable for this.

---

net/ipv6/addrconf.c +1 -6
index 52d10d2..c173549 100644
@@ -255,11 +255,6 @@ static void addrconf_mod_timer(struct inet6_ifaddr *ifp,
 
 static int snmp6_alloc_dev(struct inet6_dev *idev)
 {
-	int err = -ENOMEM;
-
-	if (!idev || !idev->dev)
-		return -EINVAL;
-
 	if (snmp_mib_init((void **)idev->stats.ipv6,
 			  sizeof(struct ipstats_mib),
 			  __alignof__(struct ipstats_mib)) < 0)
@@ -280,7 +275,7 @@ err_icmpmsg:
 err_icmp:
 	snmp_mib_free((void **)idev->stats.ipv6);
 err_ip:
-	return err;
+	return -ENOMEM;
 }
 
 static int snmp6_free_dev(struct inet6_dev *idev)
maintainer Applied
#1 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Wed, 17 Oct 2007 14:44:44 +0400

Quoted 7 lines

This functions is never called with NULL or not setup argument, so the checks inside are redundant.

Also, the return value is always -ENOMEM, so no need in additional variable for this.

Applied.