]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
dmaengine: move module_/dma_device_put() after route free
authorVinod Koul <vkoul@kernel.org>
Tue, 24 Dec 2019 04:52:15 +0000 (10:22 +0530)
committerVinod Koul <vkoul@kernel.org>
Thu, 26 Dec 2019 04:33:55 +0000 (10:03 +0530)
We call dma_device_put() and module_put() after invoking
.device_free_chan_resources callback, but we should also take care of
router devices and invoke this after .route_free callback. So move it
after .route_free

Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/dmaengine.c

index e316abe3672dc746268317e3a08861a94b79fb55..0505ea5b002fa53c2aba0c208f9bdf77cc496ea8 100644 (file)
@@ -427,15 +427,15 @@ static void dma_chan_put(struct dma_chan *chan)
                chan->device->device_free_chan_resources(chan);
        }
 
-       dma_device_put(chan->device);
-       module_put(dma_chan_to_owner(chan));
-
        /* If the channel is used via a DMA request router, free the mapping */
        if (chan->router && chan->router->route_free) {
                chan->router->route_free(chan->router->dev, chan->route_data);
                chan->router = NULL;
                chan->route_data = NULL;
        }
+
+       dma_device_put(chan->device);
+       module_put(dma_chan_to_owner(chan));
 }
 
 enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie)