From d65edba75b0491010c980ca1f916473970fd0a6c Mon Sep 17 00:00:00 2001 From: mav Date: Wed, 18 Feb 2009 21:12:48 +0000 Subject: [PATCH] Make ch->dma.free() called symmetrically to ch->dma.alloc(). --- sys/dev/ata/ata-all.c | 5 +++++ sys/dev/ata/ata-pci.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 228ee1d9a90..0bda3217c83 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -186,6 +186,11 @@ ata_detach(device_t dev) bus_teardown_intr(dev, ch->r_irq, ch->ih); bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq); ch->r_irq = NULL; + + /* free DMA resources if DMA HW present*/ + if (ch->dma.free) + ch->dma.free(dev); + mtx_destroy(&ch->state_mtx); mtx_destroy(&ch->queue_mtx); return 0; diff --git a/sys/dev/ata/ata-pci.c b/sys/dev/ata/ata-pci.c index 68c209fe21c..cbec410f76c 100644 --- a/sys/dev/ata/ata-pci.c +++ b/sys/dev/ata/ata-pci.c @@ -544,14 +544,11 @@ ata_pcichannel_attach(device_t dev) static int ata_pcichannel_detach(device_t dev) { - struct ata_channel *ch = device_get_softc(dev); int error; if ((error = ata_detach(dev))) return error; - ch->dma.free(dev); - /* XXX SOS free resources for io and ctlio ?? */ return 0; -- 2.45.0