linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: use PTR_RET
@ 2012-10-29  0:40 Fengguang Wu
  2012-10-29  0:55 ` [PATCH] netfilter: ipv6: " Fengguang Wu
  2012-10-29  9:03 ` [PATCH] netfilter: " Pablo Neira Ayuso
  0 siblings, 2 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-10-29  0:40 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Patrick McHardy, netfilter-devel, linux-kernel

Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR

Generated by: coccinelle/api/ptr_ret.cocci

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
---

 net/ipv4/netfilter/iptable_nat.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- linux-next.orig/net/ipv4/netfilter/iptable_nat.c	2012-10-23 09:44:52.577430992 +0800
+++ linux-next/net/ipv4/netfilter/iptable_nat.c	2012-10-29 08:38:43.063222201 +0800
@@ -274,9 +274,7 @@ static int __net_init iptable_nat_net_in
 		return -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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] netfilter: ipv6: use PTR_RET
  2012-10-29  0:40 [PATCH] netfilter: use PTR_RET Fengguang Wu
@ 2012-10-29  0:55 ` Fengguang Wu
  2012-10-29  9:03 ` [PATCH] netfilter: " Pablo Neira Ayuso
  1 sibling, 0 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-10-29  0:55 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Patrick McHardy, netfilter-devel, linux-kernel

Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR

Generated by: coccinelle/api/ptr_ret.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---
 net/ipv6/netfilter/ip6table_nat.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

--- linux-next.orig/net/ipv6/netfilter/ip6table_nat.c	2012-10-23 09:44:52.637430993 +0800
+++ linux-next/net/ipv6/netfilter/ip6table_nat.c	2012-10-29 08:53:41.579243556 +0800
@@ -275,9 +275,7 @@ static int __net_init ip6table_nat_net_i
 		return -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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] netfilter: use PTR_RET
  2012-10-29  0:40 [PATCH] netfilter: use PTR_RET Fengguang Wu
  2012-10-29  0:55 ` [PATCH] netfilter: ipv6: " Fengguang Wu
@ 2012-10-29  9:03 ` Pablo Neira Ayuso
  2012-10-29  9:13   ` Fengguang Wu
  1 sibling, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2012-10-29  9:03 UTC (permalink / raw)
  To: Fengguang Wu; +Cc: Patrick McHardy, netfilter-devel, linux-kernel

On Mon, Oct 29, 2012 at 08:40:44AM +0800, Fengguang Wu wrote:
> Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR
> 
> Generated 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] netfilter: use PTR_RET
  2012-10-29  9:03 ` [PATCH] netfilter: " Pablo Neira Ayuso
@ 2012-10-29  9:13   ` Fengguang Wu
  0 siblings, 0 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-10-29  9:13 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: Patrick McHardy, netfilter-devel, linux-kernel

On Mon, Oct 29, 2012 at 10:03:47AM +0100, Pablo Neira Ayuso wrote:
> On Mon, Oct 29, 2012 at 08:40:44AM +0800, Fengguang Wu wrote:
> > Use PTR_RET rather than if(IS_ERR(...)) + PTR_ERR
> > 
> > Generated 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.

That would be good, thanks!

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-29  9:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-29  0:40 [PATCH] netfilter: use PTR_RET Fengguang Wu
2012-10-29  0:55 ` [PATCH] netfilter: ipv6: " Fengguang Wu
2012-10-29  9:03 ` [PATCH] netfilter: " Pablo Neira Ayuso
2012-10-29  9:13   ` Fengguang Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).