Skip to contentSkip to conversation

netfilter: Compress return logic

PATCH New simran singhal 1 participant 1 message Mar 28, 2017

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

PATCH v3 1/1 netfilter: Compress return logic

Simplify function returns by merging assignment and return into one statement.

---
v3:
-change commit message.
-merge two patches into one.
v2:
-Change the subject of cover patch

 net/netfilter/ipset/ip_set_list_set.c | 5 +----
 net/netfilter/ipvs/ip_vs_ftp.c        | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
net/netfilter/ipset/ip_set_list_set.c +1 -4
index 178d4eb..2fff6b5 100644
@@ -453,7 +453,6 @@ static size_t
 list_set_memsize(const struct list_set *map, size_t dsize)
 {
 	struct set_elem *e;
-	size_t memsize;
 	u32 n = 0;
 
 	rcu_read_lock();
@@ -461,9 +460,7 @@ list_set_memsize(const struct list_set *map, size_t dsize)
 		n++;
 	rcu_read_unlock();
 
-	memsize = sizeof(*map) + n * dsize;
-
-	return memsize;
+	return (sizeof(*map) + n * dsize);
 }
 
 static int
net/netfilter/ipvs/ip_vs_ftp.c +1 -4
index d30c327..c93c937 100644
@@ -482,11 +482,8 @@ static struct pernet_operations ip_vs_ftp_ops = {
 
 static int __init ip_vs_ftp_init(void)
 {
-	int rv;
-
-	rv = register_pernet_subsys(&ip_vs_ftp_ops);
 	/* rcu_barrier() is called by netns on error */
-	return rv;
+	return register_pernet_subsys(&ip_vs_ftp_ops);
 }
 
 /*
Signature · 1 line
2.7.4