All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@intel.com>
To: walter harms <wharms@bfs.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	netfilter-devel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] netfilter: PTR_RET can be used
Date: Sun, 29 Jul 2012 12:14:49 +0000	[thread overview]
Message-ID: <20120729121449.GA16489@localhost> (raw)
In-Reply-To: <5015280A.6000105@bfs.de>

> > --- linux.orig/net/bridge/netfilter/ebtable_filter.c	2012-07-29 08:41:09.703759534 +0800
> > +++ linux/net/bridge/netfilter/ebtable_filter.c	2012-07-29 08:41:14.255759643 +0800
> > @@ -100,9 +100,7 @@ static struct nf_hook_ops ebt_ops_filter
> >  static int __net_init frame_filter_net_init(struct net *net)
> >  {
> >  	net->xt.frame_filter = ebt_register_table(net, &frame_filter);
> > -	if (IS_ERR(net->xt.frame_filter))
> > -		return PTR_ERR(net->xt.frame_filter);
> > -	return 0;
> > +	return PTR_RET(net->xt.frame_filter);
> >  }
> >  
> 
> i do not understand this,
> ebt_register_table() return (struct ebt_table *) on success
> 
> Does PTR_RET really return 0 if this is a propper pointer ?

Right. Here is how PTR_RET defined. This patch does not change any behavior.

static inline int __must_check PTR_RET(const void *ptr)
{      
        if (IS_ERR(ptr))
                return PTR_ERR(ptr);
        else   
                return 0;
}

Thanks,
Fengguang

WARNING: multiple messages have this Message-ID (diff)
From: Fengguang Wu <fengguang.wu@intel.com>
To: walter harms <wharms@bfs.de>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>,
	netfilter-devel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] netfilter: PTR_RET can be used
Date: Sun, 29 Jul 2012 20:14:49 +0800	[thread overview]
Message-ID: <20120729121449.GA16489@localhost> (raw)
In-Reply-To: <5015280A.6000105@bfs.de>

> > --- linux.orig/net/bridge/netfilter/ebtable_filter.c	2012-07-29 08:41:09.703759534 +0800
> > +++ linux/net/bridge/netfilter/ebtable_filter.c	2012-07-29 08:41:14.255759643 +0800
> > @@ -100,9 +100,7 @@ static struct nf_hook_ops ebt_ops_filter
> >  static int __net_init frame_filter_net_init(struct net *net)
> >  {
> >  	net->xt.frame_filter = ebt_register_table(net, &frame_filter);
> > -	if (IS_ERR(net->xt.frame_filter))
> > -		return PTR_ERR(net->xt.frame_filter);
> > -	return 0;
> > +	return PTR_RET(net->xt.frame_filter);
> >  }
> >  
> 
> i do not understand this,
> ebt_register_table() return (struct ebt_table *) on success
> 
> Does PTR_RET really return 0 if this is a propper pointer ?

Right. Here is how PTR_RET defined. This patch does not change any behavior.

static inline int __must_check PTR_RET(const void *ptr)
{      
        if (IS_ERR(ptr))
                return PTR_ERR(ptr);
        else   
                return 0;
}

Thanks,
Fengguang

  reply	other threads:[~2012-07-29 12:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-29  0:45 [PATCH] netfilter: PTR_RET can be used Fengguang Wu
2012-07-29  0:45 ` Fengguang Wu
2012-07-29 12:09 ` walter harms
2012-07-29 12:09   ` walter harms
2012-07-29 12:14   ` Fengguang Wu [this message]
2012-07-29 12:14     ` Fengguang Wu
2012-08-20 14:51     ` Pablo Neira Ayuso
2012-08-20 14:51       ` Pablo Neira Ayuso
2012-07-29 14:39 ` walter harms

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120729121449.GA16489@localhost \
    --to=fengguang.wu@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=wharms@bfs.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.