[CIFS] Fix sparse warnings

Signed-off-by: Shirish Pargaonkar <shirishp@us.ibm.com>
CC: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>

+18 -12
+17 -9
fs/cifs/dir.c
··· 149 149 pCifsFile->pid = current->tgid; 150 150 pCifsFile->pInode = newinode; 151 151 pCifsFile->invalidHandle = false; 152 - pCifsFile->closePend = false; 152 + pCifsFile->closePend = false; 153 153 mutex_init(&pCifsFile->fh_mutex); 154 154 mutex_init(&pCifsFile->lock_mutex); 155 155 INIT_LIST_HEAD(&pCifsFile->llist); ··· 162 162 pCifsInode = CIFS_I(newinode); 163 163 if (pCifsInode) { 164 164 /* if readable file instance put first in list*/ 165 - if (write_only) { 165 + if (write_only) 166 166 list_add_tail(&pCifsFile->flist, 167 167 &pCifsInode->openFileList); 168 - } else { 169 - list_add(&pCifsFile->flist, 170 - &pCifsInode->openFileList); 171 - } 168 + else 169 + list_add(&pCifsFile->flist, &pCifsInode->openFileList); 170 + 172 171 if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { 173 172 pCifsInode->clientCanCacheAll = true; 174 173 pCifsInode->clientCanCacheRead = true; 175 - cFYI(1, ("Exclusive Oplock inode %p", 176 - newinode)); 174 + cFYI(1, ("Exclusive Oplock inode %p", newinode)); 177 175 } else if ((oplock & 0xF) == OPLOCK_READ) 178 - pCifsInode->clientCanCacheRead = true; 176 + pCifsInode->clientCanCacheRead = true; 179 177 } 180 178 write_unlock(&GlobalSMBSeslock); 181 179 } ··· 666 668 parent_dir_inode->i_sb, mode, 667 669 nd->intent.open.flags, &oplock, 668 670 &fileHandle, xid); 671 + /* 672 + * This code works around a bug in 673 + * samba posix open in samba versions 3.3.1 674 + * and earlier where create works 675 + * but open fails with invalid parameter. 676 + * If either of these error codes are 677 + * returned, follow the normal lookup. 678 + * Otherwise, the error during posix open 679 + * is handled. 680 + */ 669 681 if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) 670 682 posix_open = true; 671 683 }
+1 -3
fs/cifs/file.c
··· 307 307 rc = 0; 308 308 FreeXid(xid); 309 309 return rc; 310 - } else { 311 - if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) 310 + } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) 312 311 cERROR(1, ("could not find file instance for " 313 312 "new file %p", file)); 314 - } 315 313 316 314 full_path = build_path_from_dentry(file->f_path.dentry); 317 315 if (full_path == NULL) {