Commit 19e303d6 authored by Wu Fengguang's avatar Wu Fengguang Committed by Pablo Neira Ayuso

netfilter: PTR_RET can be used

This quiets the coccinelle warnings:

net/bridge/netfilter/ebtable_filter.c:107:1-3: WARNING: PTR_RET can be used
net/bridge/netfilter/ebtable_nat.c:107:1-3: WARNING: PTR_RET can be used
net/ipv6/netfilter/ip6table_filter.c:65:1-3: WARNING: PTR_RET can be used
net/ipv6/netfilter/ip6table_mangle.c:100:1-3: WARNING: PTR_RET can be used
net/ipv6/netfilter/ip6table_raw.c:44:1-3: WARNING: PTR_RET can be used
net/ipv6/netfilter/ip6table_security.c:62:1-3: WARNING: PTR_RET can be used
net/ipv4/netfilter/iptable_filter.c:72:1-3: WARNING: PTR_RET can be used
net/ipv4/netfilter/iptable_mangle.c:107:1-3: WARNING: PTR_RET can be used
net/ipv4/netfilter/iptable_raw.c:51:1-3: WARNING: PTR_RET can be used
net/ipv4/netfilter/iptable_security.c:70:1-3: WARNING: PTR_RET can be used
Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 3654e611
...@@ -100,9 +100,7 @@ static struct nf_hook_ops ebt_ops_filter[] __read_mostly = { ...@@ -100,9 +100,7 @@ static struct nf_hook_ops ebt_ops_filter[] __read_mostly = {
static int __net_init frame_filter_net_init(struct net *net) static int __net_init frame_filter_net_init(struct net *net)
{ {
net->xt.frame_filter = ebt_register_table(net, &frame_filter); net->xt.frame_filter = ebt_register_table(net, &frame_filter);
if (IS_ERR(net->xt.frame_filter)) return PTR_RET(net->xt.frame_filter);
return PTR_ERR(net->xt.frame_filter);
return 0;
} }
static void __net_exit frame_filter_net_exit(struct net *net) static void __net_exit frame_filter_net_exit(struct net *net)
......
...@@ -100,9 +100,7 @@ static struct nf_hook_ops ebt_ops_nat[] __read_mostly = { ...@@ -100,9 +100,7 @@ static struct nf_hook_ops ebt_ops_nat[] __read_mostly = {
static int __net_init frame_nat_net_init(struct net *net) static int __net_init frame_nat_net_init(struct net *net)
{ {
net->xt.frame_nat = ebt_register_table(net, &frame_nat); net->xt.frame_nat = ebt_register_table(net, &frame_nat);
if (IS_ERR(net->xt.frame_nat)) return PTR_RET(net->xt.frame_nat);
return PTR_ERR(net->xt.frame_nat);
return 0;
} }
static void __net_exit frame_nat_net_exit(struct net *net) static void __net_exit frame_nat_net_exit(struct net *net)
......
...@@ -69,9 +69,7 @@ static int __net_init iptable_filter_net_init(struct net *net) ...@@ -69,9 +69,7 @@ static int __net_init iptable_filter_net_init(struct net *net)
net->ipv4.iptable_filter = net->ipv4.iptable_filter =
ipt_register_table(net, &packet_filter, repl); ipt_register_table(net, &packet_filter, repl);
kfree(repl); kfree(repl);
if (IS_ERR(net->ipv4.iptable_filter)) return PTR_RET(net->ipv4.iptable_filter);
return PTR_ERR(net->ipv4.iptable_filter);
return 0;
} }
static void __net_exit iptable_filter_net_exit(struct net *net) static void __net_exit iptable_filter_net_exit(struct net *net)
......
...@@ -104,9 +104,7 @@ static int __net_init iptable_mangle_net_init(struct net *net) ...@@ -104,9 +104,7 @@ static int __net_init iptable_mangle_net_init(struct net *net)
net->ipv4.iptable_mangle = net->ipv4.iptable_mangle =
ipt_register_table(net, &packet_mangler, repl); ipt_register_table(net, &packet_mangler, repl);
kfree(repl); kfree(repl);
if (IS_ERR(net->ipv4.iptable_mangle)) return PTR_RET(net->ipv4.iptable_mangle);
return PTR_ERR(net->ipv4.iptable_mangle);
return 0;
} }
static void __net_exit iptable_mangle_net_exit(struct net *net) static void __net_exit iptable_mangle_net_exit(struct net *net)
......
...@@ -48,9 +48,7 @@ static int __net_init iptable_raw_net_init(struct net *net) ...@@ -48,9 +48,7 @@ static int __net_init iptable_raw_net_init(struct net *net)
net->ipv4.iptable_raw = net->ipv4.iptable_raw =
ipt_register_table(net, &packet_raw, repl); ipt_register_table(net, &packet_raw, repl);
kfree(repl); kfree(repl);
if (IS_ERR(net->ipv4.iptable_raw)) return PTR_RET(net->ipv4.iptable_raw);
return PTR_ERR(net->ipv4.iptable_raw);
return 0;
} }
static void __net_exit iptable_raw_net_exit(struct net *net) static void __net_exit iptable_raw_net_exit(struct net *net)
......
...@@ -66,10 +66,7 @@ static int __net_init iptable_security_net_init(struct net *net) ...@@ -66,10 +66,7 @@ static int __net_init iptable_security_net_init(struct net *net)
net->ipv4.iptable_security = net->ipv4.iptable_security =
ipt_register_table(net, &security_table, repl); ipt_register_table(net, &security_table, repl);
kfree(repl); kfree(repl);
if (IS_ERR(net->ipv4.iptable_security)) return PTR_RET(net->ipv4.iptable_security);
return PTR_ERR(net->ipv4.iptable_security);
return 0;
} }
static void __net_exit iptable_security_net_exit(struct net *net) static void __net_exit iptable_security_net_exit(struct net *net)
......
...@@ -61,9 +61,7 @@ static int __net_init ip6table_filter_net_init(struct net *net) ...@@ -61,9 +61,7 @@ static int __net_init ip6table_filter_net_init(struct net *net)
net->ipv6.ip6table_filter = net->ipv6.ip6table_filter =
ip6t_register_table(net, &packet_filter, repl); ip6t_register_table(net, &packet_filter, repl);
kfree(repl); kfree(repl);
if (IS_ERR(net->ipv6.ip6table_filter)) return PTR_RET(net->ipv6.ip6table_filter);
return PTR_ERR(net->ipv6.ip6table_filter);
return 0;
} }
static void __net_exit ip6table_filter_net_exit(struct net *net) static void __net_exit ip6table_filter_net_exit(struct net *net)
......
...@@ -97,9 +97,7 @@ static int __net_init ip6table_mangle_net_init(struct net *net) ...@@ -97,9 +97,7 @@ static int __net_init ip6table_mangle_net_init(struct net *net)
net->ipv6.ip6table_mangle = net->ipv6.ip6table_mangle =
ip6t_register_table(net, &packet_mangler, repl); ip6t_register_table(net, &packet_mangler, repl);
kfree(repl); kfree(repl);
if (IS_ERR(net->ipv6.ip6table_mangle)) return PTR_RET(net->ipv6.ip6table_mangle);
return PTR_ERR(net->ipv6.ip6table_mangle);
return 0;
} }
static void __net_exit ip6table_mangle_net_exit(struct net *net) static void __net_exit ip6table_mangle_net_exit(struct net *net)
......
...@@ -40,9 +40,7 @@ static int __net_init ip6table_raw_net_init(struct net *net) ...@@ -40,9 +40,7 @@ static int __net_init ip6table_raw_net_init(struct net *net)
net->ipv6.ip6table_raw = net->ipv6.ip6table_raw =
ip6t_register_table(net, &packet_raw, repl); ip6t_register_table(net, &packet_raw, repl);
kfree(repl); kfree(repl);
if (IS_ERR(net->ipv6.ip6table_raw)) return PTR_RET(net->ipv6.ip6table_raw);
return PTR_ERR(net->ipv6.ip6table_raw);
return 0;
} }
static void __net_exit ip6table_raw_net_exit(struct net *net) static void __net_exit ip6table_raw_net_exit(struct net *net)
......
...@@ -58,10 +58,7 @@ static int __net_init ip6table_security_net_init(struct net *net) ...@@ -58,10 +58,7 @@ static int __net_init ip6table_security_net_init(struct net *net)
net->ipv6.ip6table_security = net->ipv6.ip6table_security =
ip6t_register_table(net, &security_table, repl); ip6t_register_table(net, &security_table, repl);
kfree(repl); kfree(repl);
if (IS_ERR(net->ipv6.ip6table_security)) return PTR_RET(net->ipv6.ip6table_security);
return PTR_ERR(net->ipv6.ip6table_security);
return 0;
} }
static void __net_exit ip6table_security_net_exit(struct net *net) static void __net_exit ip6table_security_net_exit(struct net *net)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment