* [PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from hugetlbfs_setattr()
@ 2017-09-29 14:54 ` Anshuman Khandual
0 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2017-09-29 14:54 UTC (permalink / raw)
To: linux-mm, linux-kernel; +Cc: nyc
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);
--
1.8.5.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from hugetlbfs_setattr()
@ 2017-09-29 14:54 ` Anshuman Khandual
0 siblings, 0 replies; 4+ messages in thread
From: Anshuman Khandual @ 2017-09-29 14:54 UTC (permalink / raw)
To: linux-mm, linux-kernel; +Cc: nyc
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);
--
1.8.5.2
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from hugetlbfs_setattr()
2017-09-29 14:54 ` Anshuman Khandual
@ 2017-09-29 17:42 ` Mike Kravetz
-1 siblings, 0 replies; 4+ messages in thread
From: Mike Kravetz @ 2017-09-29 17:42 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, linux-kernel; +Cc: nyc, Andrew Morton
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from hugetlbfs_setattr()
@ 2017-09-29 17:42 ` Mike Kravetz
0 siblings, 0 replies; 4+ messages in thread
From: Mike Kravetz @ 2017-09-29 17:42 UTC (permalink / raw)
To: Anshuman Khandual, linux-mm, linux-kernel; +Cc: nyc, Andrew Morton
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
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-29 17:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 14:54 [PATCH] mm/hugetlbfs: Remove the redundant -ENIVAL return from hugetlbfs_setattr() Anshuman Khandual
2017-09-29 14:54 ` Anshuman Khandual
2017-09-29 17:42 ` Mike Kravetz
2017-09-29 17:42 ` Mike Kravetz
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.