summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/arch/hp300/dev/hd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/arch/hp300/dev/hd.c b/sys/arch/hp300/dev/hd.c
index e5e2e2f01ee..378270a69b9 100644
--- a/sys/arch/hp300/dev/hd.c
+++ b/sys/arch/hp300/dev/hd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hd.c,v 1.54 2008/10/15 19:12:20 blambert Exp $ */
+/* $OpenBSD: hd.c,v 1.55 2009/01/25 14:29:29 miod Exp $ */
/* $NetBSD: rd.c,v 1.33 1997/07/10 18:14:08 kleink Exp $ */
/*
@@ -292,7 +292,6 @@ hdattach(parent, self, aux)
/*
* Initialize and attach the disk structure.
*/
- bzero(&sc->sc_dkdev, sizeof(sc->sc_dkdev));
sc->sc_dkdev.dk_name = sc->sc_dev.dv_xname;
disk_attach(&sc->sc_dkdev);
@@ -546,6 +545,14 @@ hdopen(dev, flags, mode, p)
if (rs == NULL)
return (ENXIO);
+ /*
+ * Fail open if we tried to attach but the disk did not answer.
+ */
+ if (!ISSET(rs->sc_dkdev.dk_flags, DKF_CONSTRUCTED)) {
+ device_unref(&rs->sc_dev);
+ return (error);
+ }
+
if ((error = hdlock(rs)) != 0) {
device_unref(&rs->sc_dev);
return (error);