From mboxrd@z Thu Jan 1 00:00:00 1970 From: Josh Triplett 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 Message-ID: <20141012225119.GB5424@thin> References: <1413146562-18147-1-git-send-email-ebiggers3@gmail.com> <1413146562-18147-2-git-send-email-ebiggers3@gmail.com> <20141012210712.GT7996@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Eric Biggers , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Al Viro Return-path: Received: from relay6-d.mail.gandi.net ([217.70.183.198]:51413 "EHLO relay6-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751506AbaJLWvZ (ORCPT ); Sun, 12 Oct 2014 18:51:25 -0400 Content-Disposition: inline In-Reply-To: <20141012210712.GT7996@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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