linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Eric Biggers <ebiggers3@gmail.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] fs/anon_inodes.c: Simplify control flow in anon_inode_getfd()
Date: Mon, 13 Oct 2014 00:51:19 +0200	[thread overview]
Message-ID: <20141012225119.GB5424@thin> (raw)
In-Reply-To: <20141012210712.GT7996@ZenIV.linux.org.uk>

On Sun, Oct 12, 2014 at 10:07:13PM +0100, Al Viro wrote:
> On Sun, Oct 12, 2014 at 03:42:39PM -0500, Eric Biggers wrote:
> >  	file = anon_inode_getfile(name, fops, priv, flags);
> >  	if (IS_ERR(file)) {
> > -		error = PTR_ERR(file);
> > -		goto err_put_unused_fd;
> > +		put_unused_fd(fd);
> > +		return PTR_ERR(file);
> >  	}
> >  	fd_install(fd, file);
> 
> at least slap unlikely() on that if (IS_ERR(...))...

That shouldn't be necessary, as far as I can tell; linux/err.h has:

#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
...
static inline bool __must_check IS_ERR(__force const void *ptr)
{
	return IS_ERR_VALUE((unsigned long)ptr);
}

So unless GCC fails to propagate expected-value handling through static
inline functions, you should never need to write unlikely(IS_ERR(...)).

- Josh Triplett

  reply	other threads:[~2014-10-12 22:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-12 20:42 [PATCH 1/5] fs/anon_inodes.c: Remove unnecessary IS_ERR(anon_inode_inode) Eric Biggers
2014-10-12 20:42 ` [PATCH 2/5] fs/anon_inodes.c: Simplify control flow in anon_inode_getfd() Eric Biggers
2014-10-12 21:07   ` Al Viro
2014-10-12 22:51     ` Josh Triplett [this message]
2014-10-12 20:42 ` [PATCH 3/5] fs/anon_inodes.c: Mark anon_inode_inode __read_mostly Eric Biggers
2014-10-12 20:42 ` [PATCH 4/5] fs/anon_inodes.c: Remove unneeded #includes Eric Biggers
2014-10-12 20:42 ` [PATCH 5/5] fs/anon_inodes.c: Remove incorrect information in comment Eric Biggers

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=20141012225119.GB5424@thin \
    --to=josh@joshtriplett.org \
    --cc=ebiggers3@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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 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).