diff mbox series

[RFC] xfs: remove unnecessary null check in xfs_generic_create

Message ID 1602232150-28805-1-git-send-email-kaixuxia@tencent.com (mailing list archive)
State Accepted
Headers show
Series [RFC] xfs: remove unnecessary null check in xfs_generic_create | expand

Commit Message

Kaixu Xia Oct. 9, 2020, 8:29 a.m. UTC
From: Kaixu Xia <kaixuxia@tencent.com>

The function posix_acl_release() test the passed-in argument and
move on only when it is non-null, so maybe the null check in
xfs_generic_create is unnecessary.

Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
---
 fs/xfs/xfs_iops.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Darrick J. Wong Oct. 9, 2020, 3:45 p.m. UTC | #1
On Fri, Oct 09, 2020 at 04:29:10PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> The function posix_acl_release() test the passed-in argument and
> move on only when it is non-null, so maybe the null check in
> xfs_generic_create is unnecessary.
> 
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

Heh, yep.  Nice cleanup.
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/xfs_iops.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 5e165456da68..5907e999642c 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -206,10 +206,8 @@ xfs_generic_create(
>  	xfs_finish_inode_setup(ip);
>  
>   out_free_acl:
> -	if (default_acl)
> -		posix_acl_release(default_acl);
> -	if (acl)
> -		posix_acl_release(acl);
> +	posix_acl_release(default_acl);
> +	posix_acl_release(acl);
>  	return error;
>  
>   out_cleanup_inode:
> -- 
> 2.20.0
>
Christoph Hellwig Oct. 15, 2020, 8:29 a.m. UTC | #2
On Fri, Oct 09, 2020 at 04:29:10PM +0800, xiakaixu1987@gmail.com wrote:
> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> The function posix_acl_release() test the passed-in argument and
> move on only when it is non-null, so maybe the null check in
> xfs_generic_create is unnecessary.
> 
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>
Kaixu Xia Nov. 12, 2020, 2:32 a.m. UTC | #3
On 2020/10/9 23:45, Darrick J. Wong wrote:
> On Fri, Oct 09, 2020 at 04:29:10PM +0800, xiakaixu1987@gmail.com wrote:
>> From: Kaixu Xia <kaixuxia@tencent.com>
>>
>> The function posix_acl_release() test the passed-in argument and
>> move on only when it is non-null, so maybe the null check in
>> xfs_generic_create is unnecessary.
>>
>> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
> 
> Heh, yep.  Nice cleanup.
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

Hi Darrick,

There are some patches that have been reviewed but not been merged
into xfs for-next branch, I will reply to them.
Sorry for the noise:)

Thanks,
Kaixu
> 
> --D
> 
>> ---
>>  fs/xfs/xfs_iops.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
>> index 5e165456da68..5907e999642c 100644
>> --- a/fs/xfs/xfs_iops.c
>> +++ b/fs/xfs/xfs_iops.c
>> @@ -206,10 +206,8 @@ xfs_generic_create(
>>  	xfs_finish_inode_setup(ip);
>>  
>>   out_free_acl:
>> -	if (default_acl)
>> -		posix_acl_release(default_acl);
>> -	if (acl)
>> -		posix_acl_release(acl);
>> +	posix_acl_release(default_acl);
>> +	posix_acl_release(acl);
>>  	return error;
>>  
>>   out_cleanup_inode:
>> -- 
>> 2.20.0
>>
diff mbox series

Patch

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 5e165456da68..5907e999642c 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -206,10 +206,8 @@  xfs_generic_create(
 	xfs_finish_inode_setup(ip);
 
  out_free_acl:
-	if (default_acl)
-		posix_acl_release(default_acl);
-	if (acl)
-		posix_acl_release(acl);
+	posix_acl_release(default_acl);
+	posix_acl_release(acl);
 	return error;
 
  out_cleanup_inode: