diff mbox series

[07/15] xfs: shmem_file_setup can't return NULL

Message ID 20240103084126.513354-8-hch@lst.de (mailing list archive)
State Superseded
Headers show
Series [01/15] shmem: move the shmem_mapping assert into shmem_get_folio_gfp | expand

Commit Message

Christoph Hellwig Jan. 3, 2024, 8:41 a.m. UTC
shmem_file_setup always returns a struct file pointer or an ERR_PTR,
so remove the code to check for a NULL return.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/scrub/xfile.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Darrick J. Wong Jan. 3, 2024, 11:56 p.m. UTC | #1
On Wed, Jan 03, 2024 at 08:41:18AM +0000, Christoph Hellwig wrote:
> shmem_file_setup always returns a struct file pointer or an ERR_PTR,
> so remove the code to check for a NULL return.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

I guess the bots will stop hassling me about this if I say
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
>  fs/xfs/scrub/xfile.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c
> index 46f4a06029cd4b..ec1be08937977a 100644
> --- a/fs/xfs/scrub/xfile.c
> +++ b/fs/xfs/scrub/xfile.c
> @@ -62,15 +62,13 @@ xfile_create(
>  {
>  	struct inode		*inode;
>  	struct xfile		*xf;
> -	int			error = -ENOMEM;
> +	int			error;
>  
>  	xf = kmalloc(sizeof(struct xfile), XCHK_GFP_FLAGS);
>  	if (!xf)
>  		return -ENOMEM;
>  
>  	xf->file = shmem_file_setup(description, isize, 0);
> -	if (!xf->file)
> -		goto out_xfile;
>  	if (IS_ERR(xf->file)) {
>  		error = PTR_ERR(xf->file);
>  		goto out_xfile;
> -- 
> 2.39.2
> 
>
diff mbox series

Patch

diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c
index 46f4a06029cd4b..ec1be08937977a 100644
--- a/fs/xfs/scrub/xfile.c
+++ b/fs/xfs/scrub/xfile.c
@@ -62,15 +62,13 @@  xfile_create(
 {
 	struct inode		*inode;
 	struct xfile		*xf;
-	int			error = -ENOMEM;
+	int			error;
 
 	xf = kmalloc(sizeof(struct xfile), XCHK_GFP_FLAGS);
 	if (!xf)
 		return -ENOMEM;
 
 	xf->file = shmem_file_setup(description, isize, 0);
-	if (!xf->file)
-		goto out_xfile;
 	if (IS_ERR(xf->file)) {
 		error = PTR_ERR(xf->file);
 		goto out_xfile;