diff mbox

[2/3] cifs: consolidate error handling in several functions

Message ID 1281017916-31380-3-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton Aug. 5, 2010, 2:18 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index f8d02f0..90d1f53 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -197,8 +197,10 @@  int cifs_posix_open(char *full_path, struct inode **pinode,
 	cFYI(1, "posix open %s", full_path);
 
 	presp_data = kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL);
-	if (presp_data == NULL)
-		return -ENOMEM;
+	if (presp_data == NULL) {
+		rc = -ENOMEM;
+		goto posix_open_ret;
+	}
 
 /* So far cifs posix extensions can only map the following flags.
    There are other valid fmode oflags such as FMODE_LSEEK, FMODE_PREAD, but
@@ -305,8 +307,7 @@  cifs_create(struct inode *inode, struct dentry *direntry, int mode,
 	full_path = build_path_from_dentry(direntry);
 	if (full_path == NULL) {
 		rc = -ENOMEM;
-		FreeXid(xid);
-		return rc;
+		goto cifs_create_out;
 	}
 
 	if (oplockEnabled)
@@ -365,9 +366,8 @@  cifs_create(struct inode *inode, struct dentry *direntry, int mode,
 
 	buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
 	if (buf == NULL) {
-		kfree(full_path);
-		FreeXid(xid);
-		return -ENOMEM;
+		rc = -ENOMEM;
+		goto cifs_create_out;
 	}
 
 	/*
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index fa04a00d..55ced02 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -242,8 +242,7 @@  int cifs_open(struct inode *inode, struct file *file)
 	full_path = build_path_from_dentry(file->f_path.dentry);
 	if (full_path == NULL) {
 		rc = -ENOMEM;
-		FreeXid(xid);
-		return rc;
+		goto out;
 	}
 
 	cFYI(1, "inode = 0x%p file flags are 0x%x for %s",