• Jon Hunter's avatar
    dmaengine: tegra210-adma: Fix crash during probe · b53611fb
    Jon Hunter authored
    Commit f33e7bb3 ("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: f33e7bb3 ("dmaengine: tegra210-adma: restore channel status")
    Signed-off-by: default avatarJon Hunter <jonathanh@nvidia.com>
    Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
    b53611fb
tegra210-adma.c 25 KB