summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2005-03-03 01:41:46 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2005-03-03 01:41:46 +0000
commit398f76333463e3b823fd242357811314b1b7197f (patch)
tree24a05649da46e15fb245b76b627ba4689c62962f
parentef616ecd1d0418334dd23097fa6a34999a8cca17 (diff)
Do not let dma attach children if it could not initialize properly.
-rw-r--r--sys/dev/ic/lsi64854.c15
-rw-r--r--sys/dev/ic/lsi64854var.h4
-rw-r--r--sys/dev/sbus/dma_sbus.c5
3 files changed, 14 insertions, 10 deletions
diff --git a/sys/dev/ic/lsi64854.c b/sys/dev/ic/lsi64854.c
index e460db2acf0..17760eaa162 100644
--- a/sys/dev/ic/lsi64854.c
+++ b/sys/dev/ic/lsi64854.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsi64854.c,v 1.5 2002/03/14 01:26:54 millert Exp $ */
+/* $OpenBSD: lsi64854.c,v 1.6 2005/03/03 01:41:44 miod Exp $ */
/* $NetBSD: lsi64854.c,v 1.18 2001/06/04 20:56:51 mrg Exp $ */
/*-
@@ -88,11 +88,12 @@ int lsi64854debug = 0;
* sc_channel (one of SCSI, ENET, PP)
* sc_client (one of SCSI, ENET, PP `soft_c' pointers)
*/
-void
+int
lsi64854_attach(sc)
struct lsi64854_softc *sc;
{
u_int32_t csr;
+ int rc;
/* Indirect functions */
switch (sc->sc_channel) {
@@ -112,10 +113,10 @@ lsi64854_attach(sc)
sc->reset = lsi64854_reset;
/* Allocate a dmamap */
- if (bus_dmamap_create(sc->sc_dmatag, MAX_DMA_SZ, 1, MAX_DMA_SZ,
- 0, BUS_DMA_WAITOK, &sc->sc_dmamap) != 0) {
- printf("%s: dma map create failed\n", sc->sc_dev.dv_xname);
- return;
+ if ((rc = bus_dmamap_create(sc->sc_dmatag, MAX_DMA_SZ, 1, MAX_DMA_SZ,
+ 0, BUS_DMA_WAITOK, &sc->sc_dmamap)) != 0) {
+ printf(": dma map create failed\n");
+ return (rc);
}
printf(": dma rev ");
@@ -146,6 +147,8 @@ lsi64854_attach(sc)
DPRINTF(LDB_ANY, (", burst 0x%x, csr 0x%x", sc->sc_burst, csr));
printf("\n");
+
+ return (0);
}
/*
diff --git a/sys/dev/ic/lsi64854var.h b/sys/dev/ic/lsi64854var.h
index ece40308f7e..28a9d9438d6 100644
--- a/sys/dev/ic/lsi64854var.h
+++ b/sys/dev/ic/lsi64854var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lsi64854var.h,v 1.4 2002/06/14 21:34:59 todd Exp $ */
+/* $OpenBSD: lsi64854var.h,v 1.5 2005/03/03 01:41:44 miod Exp $ */
/* $NetBSD: lsi64854var.h,v 1.4 2001/03/29 02:58:39 petrov Exp $ */
/*-
@@ -102,7 +102,7 @@ struct lsi64854_softc {
} while (0)
-void lsi64854_attach(struct lsi64854_softc *);
+int lsi64854_attach(struct lsi64854_softc *);
int lsi64854_scsi_intr(void *);
int lsi64854_enet_intr(void *);
int lsi64854_pp_intr(void *);
diff --git a/sys/dev/sbus/dma_sbus.c b/sys/dev/sbus/dma_sbus.c
index a8795269c88..dab7e6c320e 100644
--- a/sys/dev/sbus/dma_sbus.c
+++ b/sys/dev/sbus/dma_sbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dma_sbus.c,v 1.11 2003/07/03 20:36:07 jason Exp $ */
+/* $OpenBSD: dma_sbus.c,v 1.12 2005/03/03 01:41:45 miod Exp $ */
/* $NetBSD: dma_sbus.c,v 1.5 2000/07/09 20:57:42 pk Exp $ */
/*-
@@ -230,7 +230,8 @@ dmaattach_sbus(parent, self, aux)
sbus_establish(&dsc->sc_sd, &sc->sc_dev);
sbt = dma_alloc_bustag(dsc);
- lsi64854_attach(sc);
+ if (lsi64854_attach(sc) != 0)
+ return;
/* Attach children */
for (node = firstchild(sa->sa_node); node; node = nextsibling(node)) {