Skip to contentSkip to conversation

netfilter: ,[email protected]

PATCH Superseded simran singhal 2 participants 4 messages Mar 21, 2017

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover netfilter: ,[email protected]

This patch series Simplify function returns by merging assignment and return into one command line.

simran singhal (2):
netfilter: ipset: Compress return logic
netfilter: ipvs: Compress return logic

 net/netfilter/ipset/ip_set_list_set.c | 5 +----
 net/netfilter/ipvs/ip_vs_ftp.c        | 5 +----
 2 files changed, 2 insertions(+), 8 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 netfilter: ipset: Compress return logic

Simplify function returns by merging assignment and return into one command line.

---

--This is my contribution to the netfilter project of
Outreachy Round 14.

 net/netfilter/ipset/ip_set_list_set.c | 5 +----
 1 file changed, 1 insertion(+), 4 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
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 netfilter: ipvs: Compress return logic

In reply to simran singhal

Simplify function returns by merging assignment and return into one command line.

---

--This is my contribution to the netfilter project of
Outreachy Round 14.

 net/netfilter/ipvs/ip_vs_ftp.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
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
#3 lore raw

Re: [PATCH 2/2] netfilter: ipvs: Compress return logic

Hello!

Quoted 2 lines · simran singhal

Simplify function returns by merging assignment and return into one command line.

You mean "one statement"?

Quoted 16 lines

---

--This is my contribution to the netfilter project of
Outreachy Round 14.

 net/netfilter/ipvs/ip_vs_ftp.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
net/netfilter/ipvs/ip_vs_ftp.c +0 -0
index d30c327..c93c937 100644
@@ -482,11 +482,8 @@ static struct pernet_operations ip_vs_ftp_ops = {
 
 static int __init ip_vs_ftp_init(void)

net/netfilter/ipvs/ip_vs_ftp.c static struct pernet_operations ip_vs_ftp_ops = { · line 489

Quoted 10 lines
net/netfilter/ipvs/ip_vs_ftp.c +1 -4
 {
-	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);
 }
 
 /*

MBR, Sergei