summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2007-01-18 14:46:25 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2007-01-18 14:46:25 +0000
commit95cc527de50655b1a33c20291111a67d77411cee (patch)
treec5eb6a15e150bc32a7be224c190820b45488da09 /sys/dev
parentf81940d7496e91addc247a6ceccc32f333b587cb (diff)
do not freak out if cannot map physdrives into volumes and handle it proper everywhere
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/ciss.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c
index a5ef97d113a..252499e4466 100644
--- a/sys/dev/ic/ciss.c
+++ b/sys/dev/ic/ciss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ciss.c,v 1.23 2006/12/23 17:46:39 deraadt Exp $ */
+/* $OpenBSD: ciss.c,v 1.24 2007/01/18 14:46:24 mickey Exp $ */
/*
* Copyright (c) 2005,2006 Michael Shalayeff
@@ -353,6 +353,7 @@ ciss_attach(struct ciss_softc *sc)
bus_dmamap_destroy(sc->dmat, sc->cmdmap);
return -1;
}
+ bzero(sc->sc_lds, sc->maxunits * sizeof(*sc->sc_lds));
sc->sc_flush = CISS_FLUSH_ENABLE;
if (!(sc->sc_sh = shutdownhook_establish(ciss_shutdown, sc))) {
@@ -409,12 +410,8 @@ ciss_attach(struct ciss_softc *sc)
/* now map all the physdevs into their lds */
/* XXX currently we assign all pf 'em into ld#0 */
for (i = 0; i < sc->maxunits; i++)
- if (!(sc->sc_lds[i] = ciss_pdscan(sc, i))) {
- shutdownhook_disestablish(sc->sc_sh);
- bus_dmamem_free(sc->dmat, sc->cmdseg, 1);
- bus_dmamap_destroy(sc->dmat, sc->cmdmap);
- return -1;
- }
+ if (!(sc->sc_lds[i] = ciss_pdscan(sc, i)))
+ return 0;
if (bio_register(&sc->sc_dev, ciss_ioctl) != 0)
printf("%s: controller registration failed",
@@ -1060,6 +1057,8 @@ ciss_ioctl(struct device *dev, u_long cmd, caddr_t addr)
break;
}
ldp = sc->sc_lds[bv->bv_volid];
+ if (!ldp)
+ return EINVAL;
ldid = sc->scratch;
if ((error = ciss_ldid(sc, bv->bv_volid, ldid)))
break;
@@ -1096,7 +1095,7 @@ ciss_ioctl(struct device *dev, u_long cmd, caddr_t addr)
break;
}
ldp = sc->sc_lds[bd->bd_volid];
- if ((pd = bd->bd_diskid) > ldp->ndrives) {
+ if (!ldp || (pd = bd->bd_diskid) > ldp->ndrives) {
error = EINVAL;
break;
}
@@ -1150,6 +1149,8 @@ ciss_ioctl(struct device *dev, u_long cmd, caddr_t addr)
/* XXX workaround completely dumb scsi addressing */
for (ld = 0; ld < sc->maxunits; ld++) {
ldp = sc->sc_lds[ld];
+ if (!ldp)
+ continue;
for (pd = 0; pd < ldp->ndrives; pd++)
if (ldp->tgts[pd] == (CISS_BIGBIT +
bb->bb_channel * sc->ndrives +
@@ -1347,7 +1348,7 @@ ciss_blink(struct ciss_softc *sc, int ld, int pd, int stat,
return EINVAL;
ldp = sc->sc_lds[ld];
- if (pd > ldp->ndrives)
+ if (!ldp || pd > ldp->ndrives)
return EINVAL;
ldp->bling.pdtab[ldp->tgts[pd]] = stat == BIOC_SBUNBLINK? 0 :