Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1742261

Re: [PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from hugetlbfs_setattr()

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Mike Kravetz <mike.kravetz@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from hugetlbfs_setattr()
Date Fri, 29 Sep 2017 19:50:01 +0200
Message-ID <uv7Ad-Re-19@gated-at.bofh.it> (permalink)
References <uv4VJ-7x1-37@gated-at.bofh.it>
X-Original-To Anshuman Khandual <khandual@linux.vnet.ibm.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Language en-US
Content-Transfer-Encoding 7bit
X-Source-IP aserv0021.oracle.com [141.146.126.233]
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 33
Organization linux.* mail to news gateway
X-Original-Cc nyc@holomorphy.com, Andrew Morton <akpm@linux-foundation.org>
X-Original-Date Fri, 29 Sep 2017 10:42:31 -0700
X-Original-Message-ID <63e6e530-5e75-c498-3323-c91b3cd76e00@oracle.com>
X-Original-References <20170929145444.17611-1-khandual@linux.vnet.ibm.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1742261

Show key headers only | View raw


Adding akpm on Cc:

On 09/29/2017 07:54 AM, Anshuman Khandual wrote:
> There is no need to have a local return code set with -EINVAL when both the
> conditions following it return error codes appropriately. Just remove the
> redundant one.
> 
> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
> ---
>  fs/hugetlbfs/inode.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 59073e9..cff3939 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -668,7 +668,6 @@ static int hugetlbfs_setattr(struct dentry *dentry, struct iattr *attr)
>  		return error;
>  
>  	if (ia_valid & ATTR_SIZE) {
> -		error = -EINVAL;
>  		if (attr->ia_size & ~huge_page_mask(h))
>  			return -EINVAL;
>  		error = hugetlb_vmtruncate(inode, attr->ia_size);
> 

Thanks for noticing.
I would hope the compiler is smarter than the code and optimize this away.

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

-- 
Mike Kravetz

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from hugetlbfs_setattr() Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-09-29 17:00 +0200
  Re: [PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from  hugetlbfs_setattr() Mike Kravetz <mike.kravetz@oracle.com> - 2017-09-29 19:50 +0200

csiph-web