1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

use contigfree() rather than free() to free memory allocated with

contigmalloc().

reviewed by: wpaul
This commit is contained in:
Andrew Gallatin 2000-07-08 00:14:12 +00:00
parent 7ceba2d755
commit 19a6b3fea6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=62793
2 changed files with 12 additions and 8 deletions

View File

@ -630,7 +630,8 @@ static int ti_alloc_jumbo_mem(sc)
entry = malloc(sizeof(struct ti_jpool_entry),
M_DEVBUF, M_NOWAIT);
if (entry == NULL) {
free(sc->ti_cdata.ti_jumbo_buf, M_DEVBUF);
contigfree(sc->ti_cdata.ti_jumbo_buf, TI_JMEM,
M_DEVBUF);
sc->ti_cdata.ti_jumbo_buf = NULL;
printf("ti%d: no memory for jumbo "
"buffer queue!\n", sc->ti_unit);
@ -1681,7 +1682,8 @@ static int ti_attach(dev)
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ti_irq);
bus_release_resource(dev, SYS_RES_MEMORY,
TI_PCI_LOMEM, sc->ti_res);
free(sc->ti_rdata, M_DEVBUF);
contigfree(sc->ti_rdata, sizeof(struct ti_ring_data),
M_DEVBUF);
error = ENXIO;
goto fail;
}
@ -1752,8 +1754,8 @@ static int ti_detach(dev)
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ti_irq);
bus_release_resource(dev, SYS_RES_MEMORY, TI_PCI_LOMEM, sc->ti_res);
free(sc->ti_cdata.ti_jumbo_buf, M_DEVBUF);
free(sc->ti_rdata, M_DEVBUF);
contigfree(sc->ti_cdata.ti_jumbo_buf, TI_JMEM, M_DEVBUF);
contigfree(sc->ti_rdata, sizeof(struct ti_ring_data), M_DEVBUF);
ifmedia_removeall(&sc->ifmedia);
splx(s);

View File

@ -630,7 +630,8 @@ static int ti_alloc_jumbo_mem(sc)
entry = malloc(sizeof(struct ti_jpool_entry),
M_DEVBUF, M_NOWAIT);
if (entry == NULL) {
free(sc->ti_cdata.ti_jumbo_buf, M_DEVBUF);
contigfree(sc->ti_cdata.ti_jumbo_buf, TI_JMEM,
M_DEVBUF);
sc->ti_cdata.ti_jumbo_buf = NULL;
printf("ti%d: no memory for jumbo "
"buffer queue!\n", sc->ti_unit);
@ -1681,7 +1682,8 @@ static int ti_attach(dev)
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ti_irq);
bus_release_resource(dev, SYS_RES_MEMORY,
TI_PCI_LOMEM, sc->ti_res);
free(sc->ti_rdata, M_DEVBUF);
contigfree(sc->ti_rdata, sizeof(struct ti_ring_data),
M_DEVBUF);
error = ENXIO;
goto fail;
}
@ -1752,8 +1754,8 @@ static int ti_detach(dev)
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ti_irq);
bus_release_resource(dev, SYS_RES_MEMORY, TI_PCI_LOMEM, sc->ti_res);
free(sc->ti_cdata.ti_jumbo_buf, M_DEVBUF);
free(sc->ti_rdata, M_DEVBUF);
contigfree(sc->ti_cdata.ti_jumbo_buf, TI_JMEM, M_DEVBUF);
contigfree(sc->ti_rdata, sizeof(struct ti_ring_data), M_DEVBUF);
ifmedia_removeall(&sc->ifmedia);
splx(s);