diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-09-29 19:29:23 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-09-29 19:29:23 +0000 |
commit | 083fdac7cadb2c18a7da2cfa23a74f40d453a808 (patch) | |
tree | 3bf9002e9f117e4fa722d3c771bd1cc5ea71f53f /sys/dev/pci | |
parent | d3b42f3261a42f73e448005be4a627016e585e36 (diff) |
use pci_mapreg_map() and free resources on failures
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_fxp_pci.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/sys/dev/pci/if_fxp_pci.c b/sys/dev/pci/if_fxp_pci.c index 1eee133bd3c..f276b6e457a 100644 --- a/sys/dev/pci/if_fxp_pci.c +++ b/sys/dev/pci/if_fxp_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_fxp_pci.c,v 1.20 2003/06/13 17:49:03 deraadt Exp $ */ +/* $OpenBSD: if_fxp_pci.c,v 1.21 2003/09/29 19:29:22 mickey Exp $ */ /* * Copyright (c) 1995, David Greenman @@ -133,21 +133,15 @@ fxp_pci_attach(parent, self, aux) pci_intr_handle_t ih; const char *intrstr = NULL; u_int8_t enaddr[6]; - bus_space_tag_t iot = pa->pa_iot; - bus_addr_t iobase; bus_size_t iosize; pcireg_t rev = PCI_REVISION(pa->pa_class); - if (pci_io_find(pc, pa->pa_tag, FXP_PCI_IOBA, &iobase, &iosize)) { + if (pci_mapreg_map(pa, FXP_PCI_IOBA, PCI_MAPREG_TYPE_IO, 0, + &sc->sc_st, &sc->sc_sh, NULL, &iosize, 0)) { printf(": can't find i/o space\n"); return; } - if (bus_space_map(iot, iobase, iosize, 0, &sc->sc_sh)) { - printf(": can't map i/o space\n"); - return; - } - sc->sc_st = iot; sc->sc_dmat = pa->pa_dmat; /* @@ -155,6 +149,7 @@ fxp_pci_attach(parent, self, aux) */ if (pci_intr_map(pa, &ih)) { printf(": couldn't map interrupt\n"); + bus_space_unmap(sc->sc_st, sc->sc_sh, iosize); return; } @@ -166,6 +161,7 @@ fxp_pci_attach(parent, self, aux) if (intrstr != NULL) printf(" at %s", intrstr); printf("\n"); + bus_space_unmap(sc->sc_st, sc->sc_sh, iosize); return; } @@ -207,6 +203,8 @@ fxp_pci_attach(parent, self, aux) /* Do generic parts of attach. */ if (fxp_attach_common(sc, enaddr, intrstr)) { /* Failed! */ + pci_intr_disestablish(pc, sc->sc_ih); + bus_space_unmap(sc->sc_st, sc->sc_sh, iosize); return; } } |