Don't brelse(bp) if bp is null. Also, eliminate some redundancy

and dead code.

Found by:	Coverity Prevent analysis tool
This commit is contained in:
David Schultz 2005-03-18 21:23:32 +00:00
parent 010b1ca16e
commit 938838feb1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=143822

View File

@ -356,7 +356,7 @@ nfs_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
{
struct nfsnode *np = VTONFS(vp);
int biosize, i;
struct buf *bp = 0, *rabp;
struct buf *bp, *rabp;
struct vattr vattr;
struct thread *td;
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
@ -682,24 +682,17 @@ nfs_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
break;
default:
printf(" nfs_bioread: type %x unexpected\n", vp->v_type);
bp = NULL;
break;
};
if (n > 0) {
error = uiomove(bp->b_data + on, (int)n, uio);
}
switch (vp->v_type) {
case VREG:
break;
case VLNK:
if (vp->v_type == VLNK)
n = 0;
break;
case VDIR:
break;
default:
printf(" nfs_bioread: type %x unexpected\n", vp->v_type);
}
brelse(bp);
if (bp != NULL)
brelse(bp);
} while (error == 0 && uio->uio_resid > 0 && n > 0);
return (error);
}
@ -1055,12 +1048,6 @@ nfs_write(struct vop_write_args *ap)
break;
}
}
if (!bp) {
error = nfs_sigintr(nmp, NULL, td);
if (!error)
error = EINTR;
break;
}
if (bp->b_wcred == NOCRED)
bp->b_wcred = crhold(cred);
np->n_flag |= NMODIFIED;