netfilter: use PTR_RET
Subsystems (2)
PATCH 1/1 netfilter: use PTR_RET
Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR
Generated by: coccinelle/api/ptr_ret.cocci
Reported-by Fengguang Wu <[email protected]>
---
net/ipv4/netfilter/iptable_nat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/ipv4/netfilter/iptable_nat.c +1 -3
@@ -274,9 +274,7 @@ static int __net_init iptable_nat_net_inreturn -ENOMEM ; net->ipv4.nat_table =ipt_register_table (net, &nf_nat_ipv4_table, repl);kfree (repl); -if (IS_ERR (net->ipv4.nat_table)) -return PTR_ERR (net->ipv4.nat_table); -return 0 ; +return PTR_RET (net->ipv4.nat_table); } static void __net_exit iptable_nat_net_exit(struct net *net)
PATCH 1/1 netfilter: ipv6: use PTR_RET
Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR
Generated by: coccinelle/api/ptr_ret.cocci
Signed-off-by Fengguang Wu <[email protected]>
--- net/ipv6/netfilter/ip6table_nat.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/ipv6/netfilter/ip6table_nat.c +1 -3
@@ -275,9 +275,7 @@ static int __net_init ip6table_nat_net_ireturn -ENOMEM ; net->ipv6.ip6table_nat =ip6t_register_table (net, &nf_nat_ipv6_table, repl);kfree (repl); -if (IS_ERR (net->ipv6.ip6table_nat)) -return PTR_ERR (net->ipv6.ip6table_nat); -return 0 ; +return PTR_RET (net->ipv6.ip6table_nat); } static void __net_exit ip6table_nat_net_exit(struct net *net)
Quoted 3 lines · Fengguang Wu
Use
PTR_RETrather than if(IS_ERR(...)) +PTR_ERRGenerated by:
coccinelle/api/ptr_ret.cocci
Applied, thanks.
I have collapsed this patch and the one for ipv6/iptable_nat.c. They are pretty small and description is the same.
Quoted 9 lines · Pablo Neira Ayuso
Quoted 3 lines · Fengguang Wu
Use
PTR_RETrather than if(IS_ERR(...)) +PTR_ERRGenerated by:
coccinelle/api/ptr_ret.cocciApplied, thanks.
I have collapsed this patch and the one for
ipv6/iptable_nat.c. They are pretty small and description is the same.
That would be good, thanks!
Thanks,
Fengguang