Commit d14537f1 authored by Steve French's avatar Steve French Committed by Linus Torvalds

[PATCH] cifs: remove a few redundant null pointer checks, and cleanup misc source formatting

Mostly suggested by Jesper Juhl

Signed-off-by: Steve French (sfrench@us.ibm.com)
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6a0b4824
...@@ -284,51 +284,48 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -284,51 +284,48 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
/* mknod case - do not leave file open */ /* mknod case - do not leave file open */
CIFSSMBClose(xid, pTcon, fileHandle); CIFSSMBClose(xid, pTcon, fileHandle);
} else if(newinode) { } else if(newinode) {
pCifsFile = (struct cifsFileInfo *) pCifsFile =
kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL); kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL);
if (pCifsFile) { if(pCifsFile == NULL)
memset((char *)pCifsFile, 0, goto cifs_create_out;
sizeof (struct cifsFileInfo)); memset((char *)pCifsFile, 0,
pCifsFile->netfid = fileHandle; sizeof (struct cifsFileInfo));
pCifsFile->pid = current->tgid; pCifsFile->netfid = fileHandle;
pCifsFile->pInode = newinode; pCifsFile->pid = current->tgid;
pCifsFile->invalidHandle = FALSE; pCifsFile->pInode = newinode;
pCifsFile->closePend = FALSE; pCifsFile->invalidHandle = FALSE;
init_MUTEX(&pCifsFile->fh_sem); pCifsFile->closePend = FALSE;
/* put the following in at open now */ init_MUTEX(&pCifsFile->fh_sem);
/* pCifsFile->pfile = file; */ /* set the following in open now
write_lock(&GlobalSMBSeslock); pCifsFile->pfile = file; */
list_add(&pCifsFile->tlist,&pTcon->openFileList); write_lock(&GlobalSMBSeslock);
pCifsInode = CIFS_I(newinode); list_add(&pCifsFile->tlist,&pTcon->openFileList);
if(pCifsInode) { pCifsInode = CIFS_I(newinode);
if(pCifsInode) {
/* if readable file instance put first in list*/ /* if readable file instance put first in list*/
if (write_only == TRUE) { if (write_only == TRUE) {
list_add_tail(&pCifsFile->flist, list_add_tail(&pCifsFile->flist,
&pCifsInode->openFileList); &pCifsInode->openFileList);
} else { } else {
list_add(&pCifsFile->flist, list_add(&pCifsFile->flist,
&pCifsInode->openFileList); &pCifsInode->openFileList);
}
if((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = TRUE;
pCifsInode->clientCanCacheRead = TRUE;
cFYI(1,("Exclusive Oplock granted on inode %p",
newinode));
} else if((oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = TRUE;
} }
write_unlock(&GlobalSMBSeslock); if((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = TRUE;
pCifsInode->clientCanCacheRead = TRUE;
cFYI(1,("Exclusive Oplock for inode %p",
newinode));
} else if((oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = TRUE;
} }
write_unlock(&GlobalSMBSeslock);
} }
} }
cifs_create_out:
if (buf) kfree(buf);
kfree(buf); kfree(full_path);
if (full_path)
kfree(full_path);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} }
...@@ -375,10 +372,8 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev ...@@ -375,10 +372,8 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev
} }
} }
if (full_path) kfree(full_path);
kfree(full_path);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} }
...@@ -447,8 +442,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name ...@@ -447,8 +442,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
if file exists or not but no access BB */ if file exists or not but no access BB */
} }
if (full_path) kfree(full_path);
kfree(full_path);
FreeXid(xid); FreeXid(xid);
return ERR_PTR(rc); return ERR_PTR(rc);
} }
...@@ -478,8 +472,7 @@ cifs_dir_open(struct inode *inode, struct file *file) ...@@ -478,8 +472,7 @@ cifs_dir_open(struct inode *inode, struct file *file)
cFYI(1, ("inode = 0x%p and full path is %s", inode, full_path)); cFYI(1, ("inode = 0x%p and full path is %s", inode, full_path));
if (full_path) kfree(full_path);
kfree(full_path);
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment