diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-02 11:38:22 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2009-06-02 11:38:22 +0000 |
commit | 9132c7686ce155cd8beaf41d4ba730cd0451284d (patch) | |
tree | 400596a1b09ccd3efc4c8237d6e229abddbcc4d7 /sys/dev | |
parent | 57a4c5a772d575909ce181d00e9cd115f96c8cc0 (diff) |
When we fail to find the controller type, don't continue on using the next
consecutive index which is outside the array; found by Parfait
ok oga guenther
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/eisa/cac_eisa.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/dev/eisa/cac_eisa.c b/sys/dev/eisa/cac_eisa.c index 120e9e4d871..1e9ce07c86f 100644 --- a/sys/dev/eisa/cac_eisa.c +++ b/sys/dev/eisa/cac_eisa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cac_eisa.c,v 1.3 2008/06/26 05:42:14 ray Exp $ */ +/* $OpenBSD: cac_eisa.c,v 1.4 2009/06/02 11:38:21 deraadt Exp $ */ /* $NetBSD: cac_eisa.c,v 1.1 2000/09/01 12:15:20 ad Exp $ */ /*- @@ -161,6 +161,18 @@ cac_eisa_attach(parent, self, aux) return; } + /* + * Print board type and attach to the bus-independent code. + */ + for (i = 0; i < nitems(cac_eisa_type); i++) + if (strcmp(ea->ea_idstring, cac_eisa_type[i].ct_prodstr) == 0) + break; + + if (i == nitems(cac_eisa_type)) { + printf(": failed to attach %s\n", ea->ea_idstring); + return; + } + sc->sc_iot = iot; sc->sc_ioh = ioh; sc->sc_dmat = ea->ea_dmat; @@ -201,13 +213,6 @@ cac_eisa_attach(parent, self, aux) return; } - /* - * Print board type and attach to the bus-independent code. - */ - for (i = 0; i < sizeof(cac_eisa_type) / sizeof(cac_eisa_type[0]); i++) - if (strcmp(ea->ea_idstring, cac_eisa_type[i].ct_prodstr) == 0) - break; - printf(" %s: Compaq %s\n", intrstr, cac_eisa_type[i].ct_typestr); sc->sc_cl = cac_eisa_type[i].ct_linkage; cac_init(sc, 0); |