diff mbox series

[-next] xfs: remove unnecessary check in xfile_create()

Message ID 20230824091537.1072956-1-yangyingliang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] xfs: remove unnecessary check in xfile_create() | expand

Commit Message

Yang Yingliang Aug. 24, 2023, 9:15 a.m. UTC
shmem_file_setup() returns ERR_PTR() when it fails,
so remove the unnecessary null pointer check.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 fs/xfs/scrub/xfile.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Darrick J. Wong Aug. 24, 2023, 4:14 p.m. UTC | #1
On Thu, Aug 24, 2023 at 05:15:37PM +0800, Yang Yingliang wrote:
> shmem_file_setup() returns ERR_PTR() when it fails,
> so remove the unnecessary null pointer check.

Technically correct, but what harm is there in leaving a null check in
case the shmem_file_setup function ever /does/ start returning NULL?

--D

> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  fs/xfs/scrub/xfile.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c
> index d98e8e77c684..71779d81cad7 100644
> --- a/fs/xfs/scrub/xfile.c
> +++ b/fs/xfs/scrub/xfile.c
> @@ -70,8 +70,6 @@ xfile_create(
>  		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.25.1
>
diff mbox series

Patch

diff --git a/fs/xfs/scrub/xfile.c b/fs/xfs/scrub/xfile.c
index d98e8e77c684..71779d81cad7 100644
--- a/fs/xfs/scrub/xfile.c
+++ b/fs/xfs/scrub/xfile.c
@@ -70,8 +70,6 @@  xfile_create(
 		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;