aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/readdir.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-04-02 14:47:20 -0400
committerSteve French <sfrench@us.ibm.com>2007-04-02 14:47:20 -0400
commitc33f8d32746db12ba353b0a05b25f7893a0ac344 (patch)
tree874d9ae5afa5c1d1688105974b7ef8e8c3335302 /fs/cifs/readdir.c
parent2e175a90047a2dbc76fde169c990164895b25dfc (diff)
[CIFS] Remove unnecessary checks
file->f_path.dentry or file->f_path.dentry.d_inode can't be NULL since at least ten years, similar for all but very few arguments passed in from the VFS. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r--fs/cifs/readdir.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 2a374d5215ab..3fab8ed697d1 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -444,9 +444,6 @@ static int initiate_cifs_search(const int xid, struct file *file)
444 cifsFile->invalidHandle = TRUE; 444 cifsFile->invalidHandle = TRUE;
445 cifsFile->srch_inf.endOfSearch = FALSE; 445 cifsFile->srch_inf.endOfSearch = FALSE;
446 446
447 if(file->f_path.dentry == NULL)
448 return -ENOENT;
449
450 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 447 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
451 if(cifs_sb == NULL) 448 if(cifs_sb == NULL)
452 return -EINVAL; 449 return -EINVAL;
@@ -618,20 +615,10 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
618 whether we can use the cached search results from the previous search */ 615 whether we can use the cached search results from the previous search */
619static int is_dir_changed(struct file * file) 616static int is_dir_changed(struct file * file)
620{ 617{
621 struct inode * inode; 618 struct inode *inode = file->f_path.dentry->d_inode;
622 struct cifsInodeInfo *cifsInfo; 619 struct cifsInodeInfo *cifsInfo = CIFS_I(inode);
623
624 if(file->f_path.dentry == NULL)
625 return 0;
626
627 inode = file->f_path.dentry->d_inode;
628
629 if(inode == NULL)
630 return 0;
631
632 cifsInfo = CIFS_I(inode);
633 620
634 if(cifsInfo->time == 0) 621 if (cifsInfo->time == 0)
635 return 1; /* directory was changed, perhaps due to unlink */ 622 return 1; /* directory was changed, perhaps due to unlink */
636 else 623 else
637 return 0; 624 return 0;
@@ -851,9 +838,6 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
851 if((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL)) 838 if((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL))
852 return -ENOENT; 839 return -ENOENT;
853 840
854 if(file->f_path.dentry == NULL)
855 return -ENOENT;
856
857 rc = cifs_entry_is_dot(pfindEntry,pCifsF); 841 rc = cifs_entry_is_dot(pfindEntry,pCifsF);
858 /* skip . and .. since we added them first */ 842 /* skip . and .. since we added them first */
859 if(rc != 0) 843 if(rc != 0)
@@ -997,11 +981,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
997 981
998 xid = GetXid(); 982 xid = GetXid();
999 983
1000 if(file->f_path.dentry == NULL) {
1001 FreeXid(xid);
1002 return -EIO;
1003 }
1004
1005 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 984 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1006 pTcon = cifs_sb->tcon; 985 pTcon = cifs_sb->tcon;
1007 if(pTcon == NULL) 986 if(pTcon == NULL)