diff --git a/drivers/dma/ioat.c b/drivers/dma/ioat.c index 54fdeb7c4945cd28b4cb1892ef4b4b1b7cd527be..a45872f32d505f138efffca1a27ea8256874db2d 100644 --- a/drivers/dma/ioat.c +++ b/drivers/dma/ioat.c @@ -71,7 +71,7 @@ static int ioat_setup_functionality(struct pci_dev *pdev, void __iomem *iobase) switch (version) { case IOAT_VER_1_2: device->dma = ioat_dma_probe(pdev, iobase); - if (ioat_dca_enabled) + if (device->dma && ioat_dca_enabled) device->dca = ioat_dca_init(pdev, iobase); break; default: @@ -85,17 +85,16 @@ static void ioat_shutdown_functionality(struct pci_dev *pdev) { struct ioat_device *device = pci_get_drvdata(pdev); - if (device->dma) { - ioat_dma_remove(device->dma); - device->dma = NULL; - } - if (device->dca) { unregister_dca_provider(device->dca); free_dca_provider(device->dca); device->dca = NULL; } + if (device->dma) { + ioat_dma_remove(device->dma); + device->dma = NULL; + } } static struct pci_driver ioat_pci_driver = { diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c index 59d4344db0054b10717beefd802ec4f64bb250e9..725f83f3eeb3951b168f9e7b9b34d32a1ae1b192 100644 --- a/drivers/dma/ioat_dma.c +++ b/drivers/dma/ioat_dma.c @@ -941,10 +941,10 @@ void ioat_dma_remove(struct ioatdma_device *device) struct dma_chan *chan, *_chan; struct ioat_dma_chan *ioat_chan; - dma_async_device_unregister(&device->common); - ioat_dma_remove_interrupts(device); + dma_async_device_unregister(&device->common); + pci_pool_destroy(device->dma_pool); pci_pool_destroy(device->completion_pool);