From owner-svn-src-head@FreeBSD.ORG Mon Jul 16 22:07:30 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D53C31065672; Mon, 16 Jul 2012 22:07:30 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C04538FC14; Mon, 16 Jul 2012 22:07:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q6GM7Ujl087236; Mon, 16 Jul 2012 22:07:30 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q6GM7UNS087234; Mon, 16 Jul 2012 22:07:30 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201207162207.q6GM7UNS087234@svn.freebsd.org> From: Christian Brueffer Date: Mon, 16 Jul 2012 22:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r238539 - head/sys/fs/smbfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jul 2012 22:07:31 -0000 Author: brueffer Date: Mon Jul 16 22:07:29 2012 New Revision: 238539 URL: http://svn.freebsd.org/changeset/base/238539 Log: Simply error handling by moving the allocation of np down to where it is actually used. While here, improve style a little. Submitted by: mjg MFC after: 2 weeks Modified: head/sys/fs/smbfs/smbfs_node.c Modified: head/sys/fs/smbfs/smbfs_node.c ============================================================================== --- head/sys/fs/smbfs/smbfs_node.c Mon Jul 16 20:43:28 2012 (r238538) +++ head/sys/fs/smbfs/smbfs_node.c Mon Jul 16 22:07:29 2012 (r238539) @@ -223,17 +223,15 @@ loop: if (fap == NULL) return ENOENT; - np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); error = getnewvnode("smbfs", mp, &smbfs_vnodeops, &vp); - if (error) { - free(np, M_SMBNODE); - return error; - } + if (error != 0) + return (error); error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */ - if (error != 0) { - free(np, M_SMBNODE); + if (error != 0) return (error); - } + + np = malloc(sizeof *np, M_SMBNODE, M_WAITOK | M_ZERO); + vp->v_type = fap->fa_attr & SMB_FA_DIR ? VDIR : VREG; vp->v_data = np; np->n_vnode = vp;