]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: tegra210-adma: Fix crash during probe
authorJon Hunter <jonathanh@nvidia.com>
Thu, 16 May 2019 15:53:52 +0000 (16:53 +0100)
committerVinod Koul <vkoul@kernel.org>
Tue, 21 May 2019 08:56:00 +0000 (14:26 +0530)
commitd5d519203a5f6a765b142432cef7d5f3770ffc10
treea8c3729dcdb86846970758f3fd1bc9ede5779b81
parent161598b916c369a663b538e68eb8a06aa92f9f35
dmaengine: tegra210-adma: Fix crash during probe

Commit c6d2be746471 ("dmaengine: tegra210-adma: restore channel status")
added support to save and restore the DMA channel registers when runtime
suspending the ADMA. This change is causing the kernel to crash when
probing the ADMA, if the device is probed deferred when looking up the
channel interrupts. The crash occurs because not all of the channel base
addresses have been setup at this point and in the clean-up path of the
probe, pm_runtime_suspend() is called invoking its callback which
expects all the channel base addresses to be initialised.

Although this could be fixed by simply checking for a NULL address, on
further review of the driver it seems more appropriate that we only call
pm_runtime_get_sync() after all the channel interrupts and base
addresses have been configured. Therefore, fix this crash by moving the
calls to pm_runtime_enable(), pm_runtime_get_sync() and
tegra_adma_init() after the DMA channels have been initialised.

Fixes: c6d2be746471 ("dmaengine: tegra210-adma: restore channel status")
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/tegra210-adma.c