aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/dir.c
diff options
context:
space:
mode:
authorSteve French <smfrench@austin.rr.com>2005-04-29 01:41:05 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-29 01:41:05 -0400
commitd14537f103bf746ca766f739f9f5a5bf7a8b4806 (patch)
tree421be78e49566536638effd2fa3f222686cf27fd /fs/cifs/dir.c
parent6a0b48245a135cd132e747815854e3999967f8a7 (diff)
[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: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/cifs/dir.c')
-rw-r--r--fs/cifs/dir.c83
1 files changed, 38 insertions, 45 deletions
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index f54e1866f0f4..12ba81d7b07f 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -284,51 +284,48 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
284 /* mknod case - do not leave file open */ 284 /* mknod case - do not leave file open */
285 CIFSSMBClose(xid, pTcon, fileHandle); 285 CIFSSMBClose(xid, pTcon, fileHandle);
286 } else if(newinode) { 286 } else if(newinode) {
287 pCifsFile = (struct cifsFileInfo *) 287 pCifsFile =
288 kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL); 288 kmalloc(sizeof (struct cifsFileInfo), GFP_KERNEL);
289 289
290 if (pCifsFile) { 290 if(pCifsFile == NULL)
291 memset((char *)pCifsFile, 0, 291 goto cifs_create_out;
292 sizeof (struct cifsFileInfo)); 292 memset((char *)pCifsFile, 0,
293 pCifsFile->netfid = fileHandle; 293 sizeof (struct cifsFileInfo));
294 pCifsFile->pid = current->tgid; 294 pCifsFile->netfid = fileHandle;
295 pCifsFile->pInode = newinode; 295 pCifsFile->pid = current->tgid;
296 pCifsFile->invalidHandle = FALSE; 296 pCifsFile->pInode = newinode;
297 pCifsFile->closePend = FALSE; 297 pCifsFile->invalidHandle = FALSE;
298 init_MUTEX(&pCifsFile->fh_sem); 298 pCifsFile->closePend = FALSE;
299 /* put the following in at open now */ 299 init_MUTEX(&pCifsFile->fh_sem);
300 /* pCifsFile->pfile = file; */ 300 /* set the following in open now
301 write_lock(&GlobalSMBSeslock); 301 pCifsFile->pfile = file; */
302 list_add(&pCifsFile->tlist,&pTcon->openFileList); 302 write_lock(&GlobalSMBSeslock);
303 pCifsInode = CIFS_I(newinode); 303 list_add(&pCifsFile->tlist,&pTcon->openFileList);
304 if(pCifsInode) { 304 pCifsInode = CIFS_I(newinode);
305 if(pCifsInode) {
305 /* if readable file instance put first in list*/ 306 /* if readable file instance put first in list*/
306 if (write_only == TRUE) { 307 if (write_only == TRUE) {
307 list_add_tail(&pCifsFile->flist, 308 list_add_tail(&pCifsFile->flist,
308 &pCifsInode->openFileList); 309 &pCifsInode->openFileList);
309 } else { 310 } else {
310 list_add(&pCifsFile->flist, 311 list_add(&pCifsFile->flist,
311 &pCifsInode->openFileList); 312 &pCifsInode->openFileList);
312 }
313 if((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
314 pCifsInode->clientCanCacheAll = TRUE;
315 pCifsInode->clientCanCacheRead = TRUE;
316 cFYI(1,("Exclusive Oplock granted on inode %p",
317 newinode));
318 } else if((oplock & 0xF) == OPLOCK_READ)
319 pCifsInode->clientCanCacheRead = TRUE;
320 } 313 }
321 write_unlock(&GlobalSMBSeslock); 314 if((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
315 pCifsInode->clientCanCacheAll = TRUE;
316 pCifsInode->clientCanCacheRead = TRUE;
317 cFYI(1,("Exclusive Oplock for inode %p",
318 newinode));
319 } else if((oplock & 0xF) == OPLOCK_READ)
320 pCifsInode->clientCanCacheRead = TRUE;
322 } 321 }
322 write_unlock(&GlobalSMBSeslock);
323 } 323 }
324 } 324 }
325 325cifs_create_out:
326 if (buf) 326 kfree(buf);
327 kfree(buf); 327 kfree(full_path);
328 if (full_path)
329 kfree(full_path);
330 FreeXid(xid); 328 FreeXid(xid);
331
332 return rc; 329 return rc;
333} 330}
334 331
@@ -375,10 +372,8 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev
375 } 372 }
376 } 373 }
377 374
378 if (full_path) 375 kfree(full_path);
379 kfree(full_path);
380 FreeXid(xid); 376 FreeXid(xid);
381
382 return rc; 377 return rc;
383} 378}
384 379
@@ -447,8 +442,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
447 if file exists or not but no access BB */ 442 if file exists or not but no access BB */
448 } 443 }
449 444
450 if (full_path) 445 kfree(full_path);
451 kfree(full_path);
452 FreeXid(xid); 446 FreeXid(xid);
453 return ERR_PTR(rc); 447 return ERR_PTR(rc);
454} 448}
@@ -478,8 +472,7 @@ cifs_dir_open(struct inode *inode, struct file *file)
478 472
479 cFYI(1, ("inode = 0x%p and full path is %s", inode, full_path)); 473 cFYI(1, ("inode = 0x%p and full path is %s", inode, full_path));
480 474
481 if (full_path) 475 kfree(full_path);
482 kfree(full_path);
483 FreeXid(xid); 476 FreeXid(xid);
484 return rc; 477 return rc;
485} 478}