NFS: Remove unnecessary check in nfs_read_folio()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 19 Jan 2023 21:33:51 +0000 (16:33 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 14 Feb 2023 19:22:33 +0000 (14:22 -0500)
All the callers are expected to supply a valid struct file argument, so
there is no need for the NULL check.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/read.c

index bf4154f9b48c52768e461dc944fd499871aa6376..c380cff4108e0693bd04580c18b2da9747f486da 100644 (file)
@@ -355,13 +355,7 @@ int nfs_read_folio(struct file *file, struct folio *folio)
        if (NFS_STALE(inode))
                goto out_unlock;
 
-       if (file == NULL) {
-               ret = -EBADF;
-               desc.ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
-               if (desc.ctx == NULL)
-                       goto out_unlock;
-       } else
-               desc.ctx = get_nfs_open_context(nfs_file_open_context(file));
+       desc.ctx = get_nfs_open_context(nfs_file_open_context(file));
 
        xchg(&desc.ctx->error, 0);
        nfs_pageio_init_read(&desc.pgio, inode, false,