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
This commit is contained in:
parent
cfbd0d18bb
commit
01cc0b6531
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=238539
@ -223,17 +223,15 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp,
|
||||
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;
|
||||
}
|
||||
error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */
|
||||
if (error != 0) {
|
||||
free(np, M_SMBNODE);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
}
|
||||
error = insmntque(vp, mp); /* XXX: Too early for mpsafe fs */
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user