[PATCH] xfs: remove unnecessary check

Dan Carpenter posted 1 patch 1 year, 5 months ago
fs/xfs/libxfs/xfs_inode_util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] xfs: remove unnecessary check
Posted by Dan Carpenter 1 year, 5 months ago
We checked that "pip" is non-NULL at the start of the if else statement
so there is no need to check again here.  Delete the check.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 fs/xfs/libxfs/xfs_inode_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/libxfs/xfs_inode_util.c b/fs/xfs/libxfs/xfs_inode_util.c
index 032333289113..cc38e1c3c3e1 100644
--- a/fs/xfs/libxfs/xfs_inode_util.c
+++ b/fs/xfs/libxfs/xfs_inode_util.c
@@ -308,7 +308,7 @@ xfs_inode_init(
 		    !vfsgid_in_group_p(i_gid_into_vfsgid(args->idmap, inode)))
 			inode->i_mode &= ~S_ISGID;
 
-		ip->i_projid = pip ? xfs_get_initial_prid(pip) : 0;
+		ip->i_projid = xfs_get_initial_prid(pip);
 	}
 
 	ip->i_disk_size = 0;
-- 
2.43.0
Re: [PATCH] xfs: remove unnecessary check
Posted by Chaitanya Kulkarni 1 year, 5 months ago
On 7/12/2024 7:07 AM, Dan Carpenter wrote:
> We checked that "pip" is non-NULL at the start of the if else statement
> so there is no need to check again here.  Delete the check.
> 
> Signed-off-by: Dan Carpenter<dan.carpenter@linaro.org>

Looks good.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


Re: [PATCH] xfs: remove unnecessary check
Posted by Darrick J. Wong 1 year, 5 months ago
On Fri, Jul 12, 2024 at 09:07:36AM -0500, Dan Carpenter wrote:
> We checked that "pip" is non-NULL at the start of the if else statement
> so there is no need to check again here.  Delete the check.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Yep.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/libxfs/xfs_inode_util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_inode_util.c b/fs/xfs/libxfs/xfs_inode_util.c
> index 032333289113..cc38e1c3c3e1 100644
> --- a/fs/xfs/libxfs/xfs_inode_util.c
> +++ b/fs/xfs/libxfs/xfs_inode_util.c
> @@ -308,7 +308,7 @@ xfs_inode_init(
>  		    !vfsgid_in_group_p(i_gid_into_vfsgid(args->idmap, inode)))
>  			inode->i_mode &= ~S_ISGID;
>  
> -		ip->i_projid = pip ? xfs_get_initial_prid(pip) : 0;
> +		ip->i_projid = xfs_get_initial_prid(pip);
>  	}
>  
>  	ip->i_disk_size = 0;
> -- 
> 2.43.0
> 
>