summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-06-09 05:41:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-06-09 05:41:19 +0000
commitb52737940edebc771037cdd91707518c9d55e104 (patch)
tree597e9c81776059dcc0e25a7b197011565a3e652e /sys
parent1c0909633d2b4e103358034353f0b853cf2cc50f (diff)
shorted code with a lovely goto
ok matthew
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/vnd.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index c037e173ccd..0cca86434cb 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.125 2011/06/05 18:40:33 matthew Exp $ */
+/* $OpenBSD: vnd.c,v 1.126 2011/06/09 05:41:18 deraadt Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -320,20 +320,14 @@ vndstrategy(struct buf *bp)
if ((vnd->sc_flags & VNF_INITED) == 0) {
bp->b_error = ENXIO;
bp->b_flags |= B_ERROR;
- s = splbio();
- biodone(bp);
- splx(s);
- return;
+ goto done;
}
/* Ensure that the requested block is sector aligned. */
if (bp->b_blkno % DL_BLKSPERSEC(vnd->sc_dk.dk_label) != 0) {
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
- s = splbio();
- biodone(bp);
- splx(s);
- return;
+ goto done;
}
bn = bp->b_blkno;
@@ -342,20 +336,13 @@ vndstrategy(struct buf *bp)
if (bn < 0) {
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
- s = splbio();
- biodone(bp);
- splx(s);
- return;
+ goto done;
}
/* If we have a label, do a boundary check. */
if (vnd->sc_flags & VNF_HAVELABEL) {
- if (bounds_check_with_label(bp, vnd->sc_dk.dk_label) <= 0) {
- s = splbio();
- biodone(bp);
- splx(s);
- return;
- }
+ if (bounds_check_with_label(bp, vnd->sc_dk.dk_label) <= 0)
+ goto done;
/*
* bounds_check_with_label() changes bp->b_resid, reset it
@@ -407,6 +394,7 @@ vndstrategy(struct buf *bp)
if (bp->b_error)
bp->b_flags |= B_ERROR;
bp->b_resid = auio.uio_resid;
+done:
s = splbio();
biodone(bp);
splx(s);