summaryrefslogtreecommitdiff
path: root/sys/arch/alpha
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-06-12 20:57:44 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-06-12 20:57:44 +0000
commitd92a22088820bed9b2ad499b3fb0bf27bc9f8223 (patch)
tree23eefe8eebbc59fe8751ac9fee2b2e2dcfc20830 /sys/arch/alpha
parentbb9f20de9237688ceb64944e9fdca9bd454679c0 (diff)
all disksubr.c did their b_flags manipulation differently (and wrong).
correct and unify; ok thib miod
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r--sys/arch/alpha/alpha/disksubr.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c
index 199b5acf00a..b7447c24f93 100644
--- a/sys/arch/alpha/alpha/disksubr.c
+++ b/sys/arch/alpha/alpha/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.83 2007/06/10 05:42:48 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.84 2007/06/12 20:57:41 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -389,7 +389,7 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *),
struct disklabel *lp, struct cpu_disklabel *osdep)
{
char *msg = "no disk label";
- struct buf *bp;
+ struct buf *bp = NULL;
struct disklabel dl;
struct cpu_disklabel cdl;
int labeloffset, error, i, partoff = 0, cyl = 0, needcsum = 0;
@@ -416,8 +416,10 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *),
labeloffset = I386_LABELOFFSET;
}
if (msg) {
- if (partoff == -1)
- return EIO;
+ if (partoff == -1) {
+ error = EIO;
+ goto done;
+ }
/* Write it in the regular place with native byte order. */
labeloffset = LABELOFFSET;
@@ -439,7 +441,10 @@ writedisklabel(dev_t dev, void (*strat)(struct buf *),
(*strat)(bp);
error = biowait(bp);
- bp->b_flags |= B_INVAL;
- brelse(bp);
+done:
+ if (bp) {
+ bp->b_flags |= B_INVAL;
+ brelse(bp);
+ }
return (error);
}