diff options
author | scottl <scottl@FreeBSD.org> | 2003-02-06 00:37:37 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2003-02-06 00:37:37 +0000 |
commit | 00eaa83c32411b65cb95e6eaaeeb008e38eee64a (patch) | |
tree | f7e0d52ea39cfbbefb33ab909696e3f1436c5a28 /sys/dev/aac/aac.c | |
parent | ae4d85478fbb45de6ece210a1d9010469120bef4 (diff) | |
download | FreeBSD-src-00eaa83c32411b65cb95e6eaaeeb008e38eee64a.zip FreeBSD-src-00eaa83c32411b65cb95e6eaaeeb008e38eee64a.tar.gz |
Free the container and sim objects on detach. Convert several uses of
MALLOC to malloc.
Diffstat (limited to 'sys/dev/aac/aac.c')
-rw-r--r-- | sys/dev/aac/aac.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 1353138..c9e0bc3 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -401,8 +401,8 @@ aac_add_container(struct aac_softc *sc, struct aac_mntinforesp *mir, int f) * the possible types may never show up. */ if ((mir->Status == ST_OK) && (mir->MntTable[0].VolType != CT_NONE)) { - MALLOC(co, struct aac_container *, sizeof *co, M_AACBUF, - M_NOWAIT); + co = (struct aac_container *)malloc(sizeof *co, M_AACBUF, + M_NOWAIT | M_ZERO); if (co == NULL) panic("Out of memory?!\n"); debug(1, "id %x name '%.16s' size %u type %d", @@ -495,17 +495,21 @@ aac_detach(device_t dev) return(EBUSY); /* Remove the child containers */ - TAILQ_FOREACH(co, &sc->aac_container_tqh, co_link) { + while ((co = TAILQ_FIRST(&sc->aac_container_tqh)) != NULL) { + TAILQ_REMOVE(&sc->aac_container_tqh, co, co_link); error = device_delete_child(dev, co->co_disk); if (error) return (error); + free(co, M_AACBUF); } /* Remove the CAM SIMs */ - TAILQ_FOREACH(sim, &sc->aac_sim_tqh, sim_link) { + while ((sim = TAILQ_FIRST(&sc->aac_sim_tqh)) != NULL) { + TAILQ_REMOVE(&sc->aac_sim_tqh, sim, sim_link); error = device_delete_child(dev, sim->sim_dev); if (error) return (error); + free(sim, M_AACBUF); } if (sc->aifflags & AAC_AIFFLAGS_RUNNING) { @@ -2779,8 +2783,8 @@ aac_get_bus_info(struct aac_softc *sc) if (businfo.BusValid[i] != AAC_BUS_VALID) continue; - MALLOC(caminf, struct aac_sim *, - sizeof(struct aac_sim), M_AACBUF, M_NOWAIT | M_ZERO); + caminf = (struct aac_sim *)malloc( sizeof(struct aac_sim), + M_AACBUF, M_NOWAIT | M_ZERO); if (caminf == NULL) continue; |