Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: dw-edma: Fix crash on loading/unloading driver

When the driver is compiled as a module and loaded if we try to unload
it, the Kernel shows a crash log. This Kernel crash is due to the
dma_async_device_unregister() call done after deleting the channels,
this patch fixes this issue.

Signed-off-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
Link: https://lore.kernel.org/r/4aa850c035cf7ee488f1d3fb6dee0e37be0dce0a.1613674948.git.gustavo.pimentel@synopsys.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Gustavo Pimentel and committed by
Vinod Koul
e970dcc4 5244ac2e

+11 -12
+11 -12
drivers/dma/dw-edma/dw-edma-core.c
··· 986 986 /* Power management */ 987 987 pm_runtime_disable(dev); 988 988 989 - list_for_each_entry_safe(chan, _chan, &dw->wr_edma.channels, 990 - vc.chan.device_node) { 991 - list_del(&chan->vc.chan.device_node); 992 - tasklet_kill(&chan->vc.task); 993 - } 994 - 995 - list_for_each_entry_safe(chan, _chan, &dw->rd_edma.channels, 996 - vc.chan.device_node) { 997 - list_del(&chan->vc.chan.device_node); 998 - tasklet_kill(&chan->vc.task); 999 - } 1000 - 1001 989 /* Deregister eDMA device */ 1002 990 dma_async_device_unregister(&dw->wr_edma); 991 + list_for_each_entry_safe(chan, _chan, &dw->wr_edma.channels, 992 + vc.chan.device_node) { 993 + tasklet_kill(&chan->vc.task); 994 + list_del(&chan->vc.chan.device_node); 995 + } 996 + 1003 997 dma_async_device_unregister(&dw->rd_edma); 998 + list_for_each_entry_safe(chan, _chan, &dw->rd_edma.channels, 999 + vc.chan.device_node) { 1000 + tasklet_kill(&chan->vc.task); 1001 + list_del(&chan->vc.chan.device_node); 1002 + } 1004 1003 1005 1004 /* Turn debugfs off */ 1006 1005 dw_edma_v0_core_debugfs_off(chip);