Linux-XFS Archive on lore.kernel.org
 help / color / Atom feed
* [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create
@ 2020-10-09  8:29 xiakaixu1987
  2020-10-09 15:45 ` Darrick J. Wong
  2020-10-15  8:29 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: xiakaixu1987 @ 2020-10-09  8:29 UTC (permalink / raw)
  To: linux-xfs; +Cc: darrick.wong, Kaixu Xia

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(-)

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create
  2020-10-09  8:29 [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create xiakaixu1987
@ 2020-10-09 15:45 ` Darrick J. Wong
  2020-10-15  8:29 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2020-10-09 15:45 UTC (permalink / raw)
  To: xiakaixu1987; +Cc: linux-xfs, Kaixu Xia

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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create
  2020-10-09  8:29 [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create xiakaixu1987
  2020-10-09 15:45 ` Darrick J. Wong
@ 2020-10-15  8:29 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-10-15  8:29 UTC (permalink / raw)
  To: xiakaixu1987; +Cc: linux-xfs, darrick.wong, Kaixu Xia

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09  8:29 [RFC PATCH] xfs: remove unnecessary null check in xfs_generic_create xiakaixu1987
2020-10-09 15:45 ` Darrick J. Wong
2020-10-15  8:29 ` Christoph Hellwig

Linux-XFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-xfs/0 linux-xfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-xfs linux-xfs/ https://lore.kernel.org/linux-xfs \
		linux-xfs@vger.kernel.org
	public-inbox-index linux-xfs

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-xfs


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git