diff options
author | das <das@FreeBSD.org> | 2005-03-18 21:23:32 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2005-03-18 21:23:32 +0000 |
commit | 89bc04ad2d2e5f8606b4edd112791520f620a047 (patch) | |
tree | e8962722952d29c44c375acb92b88bfbd1f409a5 /sys/nfsclient/nfs_bio.c | |
parent | fb7ab3402211ae6153f97eca35aa6df1e4b75af9 (diff) | |
download | FreeBSD-src-89bc04ad2d2e5f8606b4edd112791520f620a047.zip FreeBSD-src-89bc04ad2d2e5f8606b4edd112791520f620a047.tar.gz |
Don't brelse(bp) if bp is null. Also, eliminate some redundancy
and dead code.
Found by: Coverity Prevent analysis tool
Diffstat (limited to 'sys/nfsclient/nfs_bio.c')
-rw-r--r-- | sys/nfsclient/nfs_bio.c | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/sys/nfsclient/nfs_bio.c b/sys/nfsclient/nfs_bio.c index f877850..17c3c3d 100644 --- a/sys/nfsclient/nfs_bio.c +++ b/sys/nfsclient/nfs_bio.c @@ -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 @@ again: 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 @@ again: 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; |