From patchwork Thu Aug 5 14:18:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 117298 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o75EIkoE005656 for ; Thu, 5 Aug 2010 14:18:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760596Ab0HEOSp (ORCPT ); Thu, 5 Aug 2010 10:18:45 -0400 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.122]:54959 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760553Ab0HEOSp (ORCPT ); Thu, 5 Aug 2010 10:18:45 -0400 X-Authority-Analysis: v=1.1 cv=8Ouyix1mjDiY39+WXI3mGP2cYJJcyvuZWGfIWBrWPVc= c=1 sm=0 a=wPnfEwTuQfgA:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=J5zbRz9h7GEEZnn0vHkA:9 a=DOxOdDf_2NumMZeCkfIA:7 a=y7C26WIfZBRPJVDnyjEH_v2d6PQA:4 a=jEp0ucaQiEUA:10 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:44394] helo=mail.poochiereds.net) by cdptpa-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id CF/0B-27492-C38CA5C4; Thu, 05 Aug 2010 14:18:36 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 3191F58136; Thu, 5 Aug 2010 10:18:36 -0400 (EDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org Subject: [PATCH 2/3] cifs: consolidate error handling in several functions Date: Thu, 5 Aug 2010 10:18:35 -0400 Message-Id: <1281017916-31380-3-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.2 In-Reply-To: <1281017916-31380-1-git-send-email-jlayton@redhat.com> References: <1281017916-31380-1-git-send-email-jlayton@redhat.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 05 Aug 2010 14:18:46 +0000 (UTC) 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",