diff options
author | Christopher Pascoe <pascoe@cvs.openbsd.org> | 2007-03-04 12:23:26 +0000 |
---|---|---|
committer | Christopher Pascoe <pascoe@cvs.openbsd.org> | 2007-03-04 12:23:26 +0000 |
commit | 5d08f0b72007adabb1f7542a7226f7472f94d8bc (patch) | |
tree | 4985c5d393e35606d468fb3b71f22c1bebd3cc0a | |
parent | 8a3b9c6c99efe8d4eaa569dcf5f245607732f5d4 (diff) |
When freeing port memory, use actual pointer to port rather than random memory.
-rw-r--r-- | sys/dev/pci/ahci.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c index 926c2e044be..6df33053462 100644 --- a/sys/dev/pci/ahci.c +++ b/sys/dev/pci/ahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci.c,v 1.52 2007/03/04 12:20:17 pascoe Exp $ */ +/* $OpenBSD: ahci.c,v 1.53 2007/03/04 12:23:25 pascoe Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -721,12 +721,10 @@ freeport: void ahci_port_free(struct ahci_softc *sc, u_int port) { - struct ahci_port *ap; + struct ahci_port *ap = sc->sc_ports[port]; struct ahci_ccb *ccb; int i; - ap = sc->sc_ports[i]; - for (i = 0; i < sc->sc_ncmds; i++) { ccb = &ap->ap_ccbs[i]; @@ -737,7 +735,7 @@ ahci_port_free(struct ahci_softc *sc, u_int port) /* bus_space(9) says we dont free the subregions handle */ free(ap->ap_ccbs, M_DEVBUF); free(ap, M_DEVBUF); - sc->sc_ports[i] = NULL; + sc->sc_ports[port] = NULL; } int |