Skip to content

Commit

Permalink
cifs: consolidate error handling in several functions
Browse files Browse the repository at this point in the history
cifs has a lot of complicated functions that have to clean up things on
error, but some of them don't have all of the cleanup code
well-consolidated. Clean up and consolidate error handling in several
functions.

This is in preparation of later patches that will need to put references
to the tcon link container.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
Jeff Layton authored and Steve French committed Aug 16, 2010
1 parent 5d9ac7f commit 232341b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions fs/cifs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,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)
Expand Down Expand Up @@ -365,9 +364,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;
}

/*
Expand Down
3 changes: 1 addition & 2 deletions fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 232341b

Please sign in to comment.