summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2004-05-24 22:52:53 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2004-05-24 22:52:53 +0000
commita8b871474c824788ea46f33b59d3041d0fb64f1b (patch)
tree8c3417679093b3aa34320cc7fe7cdcc8fd0d2e42
parent76321ada69f766528442c7cbae791cb3795e9de2 (diff)
do not bother w/ void pci_devinfo() calls and free resources on failures
-rw-r--r--sys/dev/pci/ehci_pci.c9
-rw-r--r--sys/dev/pci/ohci_pci.c5
-rw-r--r--sys/dev/pci/pciide.c8
-rw-r--r--sys/dev/pci/uhci_pci.c5
-rw-r--r--sys/dev/pci/yds.c10
5 files changed, 22 insertions, 15 deletions
diff --git a/sys/dev/pci/ehci_pci.c b/sys/dev/pci/ehci_pci.c
index 560e91bb960..97c4581f1a1 100644
--- a/sys/dev/pci/ehci_pci.c
+++ b/sys/dev/pci/ehci_pci.c
@@ -110,13 +110,14 @@ ehci_pci_attach(struct device *parent, struct device *self, void *aux)
pcireg_t csr;
const char *vendor;
char *devname = sc->sc.sc_bus.bdev.dv_xname;
- char devinfo[256];
usbd_status r;
int ncomp;
struct usb_pci *up;
- pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
#if defined(__NetBSD__)
+ char devinfo[256];
+
+ pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof(devinfo));
printf(": %s (rev. 0x%02x)\n", devinfo,
PCI_REVISION(pa->pa_class));
#endif
@@ -145,6 +146,7 @@ ehci_pci_attach(struct device *parent, struct device *self, void *aux)
/* Map and establish the interrupt. */
if (pci_intr_map(pa, &ih)) {
printf(": couldn't map interrupt\n");
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
return;
}
intrstr = pci_intr_string(pc, ih);
@@ -154,6 +156,7 @@ ehci_pci_attach(struct device *parent, struct device *self, void *aux)
if (intrstr != NULL)
printf(" at %s", intrstr);
printf("\n");
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
return;
}
printf(": %s\n", intrstr);
@@ -164,6 +167,7 @@ ehci_pci_attach(struct device *parent, struct device *self, void *aux)
case PCI_USBREV_1_1:
sc->sc.sc_bus.usbrev = USBREV_UNKNOWN;
printf("%s: pre-2.0 USB rev\n", devname);
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
return;
case PCI_USBREV_2_0:
sc->sc.sc_bus.usbrev = USBREV_2_0;
@@ -201,6 +205,7 @@ ehci_pci_attach(struct device *parent, struct device *self, void *aux)
r = ehci_init(&sc->sc);
if (r != USBD_NORMAL_COMPLETION) {
printf("%s: init failed, error=%d\n", devname, r);
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
return;
}
diff --git a/sys/dev/pci/ohci_pci.c b/sys/dev/pci/ohci_pci.c
index 13a48f002c9..6b240699d32 100644
--- a/sys/dev/pci/ohci_pci.c
+++ b/sys/dev/pci/ohci_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci_pci.c,v 1.20 2004/05/23 03:23:00 deraadt Exp $ */
+/* $OpenBSD: ohci_pci.c,v 1.21 2004/05/24 22:52:52 mickey Exp $ */
/* $NetBSD: ohci_pci.c,v 1.23 2002/10/02 16:51:47 thorpej Exp $ */
/*
@@ -143,6 +143,7 @@ ohci_pci_attach(struct device *parent, struct device *self, void *aux)
/* Map and establish the interrupt. */
if (pci_intr_map(pa, &ih)) {
printf(": couldn't map interrupt\n");
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
splx(s);
return;
}
@@ -154,6 +155,7 @@ ohci_pci_attach(struct device *parent, struct device *self, void *aux)
if (intrstr != NULL)
printf(" at %s", intrstr);
printf("\n");
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
splx(s);
return;
}
@@ -173,6 +175,7 @@ ohci_pci_attach(struct device *parent, struct device *self, void *aux)
if (r != USBD_NORMAL_COMPLETION) {
printf("%s: init failed, error=%d\n",
sc->sc.sc_bus.bdev.dv_xname, r);
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
splx(s);
return;
}
diff --git a/sys/dev/pci/pciide.c b/sys/dev/pci/pciide.c
index af8015da9c8..e9b13ca3435 100644
--- a/sys/dev/pci/pciide.c
+++ b/sys/dev/pci/pciide.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pciide.c,v 1.166 2004/05/06 17:28:18 peter Exp $ */
+/* $OpenBSD: pciide.c,v 1.167 2004/05/24 22:52:52 mickey Exp $ */
/* $NetBSD: pciide.c,v 1.127 2001/08/03 01:31:08 tsutsui Exp $ */
/*
@@ -803,14 +803,10 @@ pciide_attach(parent, self, aux)
pcitag_t tag = pa->pa_tag;
struct pciide_softc *sc = (struct pciide_softc *)self;
pcireg_t csr;
- char devinfo[256];
sc->sc_pp = pciide_lookup_product(pa->pa_id);
- if (sc->sc_pp == NULL) {
+ if (sc->sc_pp == NULL)
sc->sc_pp = &default_product_desc;
- pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo,
- sizeof devinfo);
- }
sc->sc_rev = PCI_REVISION(pa->pa_class);
sc->sc_pc = pa->pa_pc;
diff --git a/sys/dev/pci/uhci_pci.c b/sys/dev/pci/uhci_pci.c
index fe7b9ee38d4..2ff8a2d0e04 100644
--- a/sys/dev/pci/uhci_pci.c
+++ b/sys/dev/pci/uhci_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci_pci.c,v 1.16 2004/05/23 03:23:00 deraadt Exp $ */
+/* $OpenBSD: uhci_pci.c,v 1.17 2004/05/24 22:52:52 mickey Exp $ */
/* $NetBSD: uhci_pci.c,v 1.24 2002/10/02 16:51:58 thorpej Exp $ */
/*
@@ -131,6 +131,7 @@ uhci_pci_attach(struct device *parent, struct device *self, void *aux)
/* Map and establish the interrupt. */
if (pci_intr_map(pa, &ih)) {
printf(": couldn't map interrupt\n");
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
return;
}
intrstr = pci_intr_string(pc, ih);
@@ -141,6 +142,7 @@ uhci_pci_attach(struct device *parent, struct device *self, void *aux)
if (intrstr != NULL)
printf(" at %s", intrstr);
printf("\n");
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
return;
}
printf(": %s\n", intrstr);
@@ -182,6 +184,7 @@ uhci_pci_attach(struct device *parent, struct device *self, void *aux)
r = uhci_init(&sc->sc);
if (r != USBD_NORMAL_COMPLETION) {
printf("%s: init failed, error=%d\n", devname, r);
+ bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size);
return;
}
diff --git a/sys/dev/pci/yds.c b/sys/dev/pci/yds.c
index 48a56acc4ed..08a636ddb59 100644
--- a/sys/dev/pci/yds.c
+++ b/sys/dev/pci/yds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yds.c,v 1.22 2004/02/19 20:11:33 markus Exp $ */
+/* $OpenBSD: yds.c,v 1.23 2004/05/24 22:52:52 mickey Exp $ */
/* $NetBSD: yds.c,v 1.5 2001/05/21 23:55:04 minoura Exp $ */
/*
@@ -666,17 +666,15 @@ yds_attach(parent, self, aux)
pci_chipset_tag_t pc = pa->pa_pc;
char const *intrstr;
pci_intr_handle_t ih;
+ bus_size_t size;
pcireg_t reg;
struct yds_codec_softc *codec;
- char devinfo[256];
mixer_ctrl_t ctl;
int i, r;
- pci_devinfo(pa->pa_id, pa->pa_class, 0, devinfo, sizeof devinfo);
-
/* Map register to memory */
if (pci_mapreg_map(pa, YDS_PCI_MBA, PCI_MAPREG_TYPE_MEM, 0,
- &sc->memt, &sc->memh, NULL, NULL, 0)) {
+ &sc->memt, &sc->memh, NULL, &size, 0)) {
printf("%s: can't map memory space\n", sc->sc_dev.dv_xname);
return;
}
@@ -684,6 +682,7 @@ yds_attach(parent, self, aux)
/* Map and establish the interrupt. */
if (pci_intr_map(pa, &ih)) {
printf("%s: couldn't map interrupt\n", sc->sc_dev.dv_xname);
+ bus_space_unmap(sc->memt, sc->memh, size);
return;
}
intrstr = pci_intr_string(pc, ih);
@@ -695,6 +694,7 @@ yds_attach(parent, self, aux)
if (intrstr != NULL)
printf(" at %s", intrstr);
printf("\n");
+ bus_space_unmap(sc->memt, sc->memh, size);
return;
}
printf(": %s\n", intrstr);