forked from luck/tmp_suning_uos_patched
dmaengine: tegra210-adma: Fix crash during probe
Commitf33e7bb3eb
("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:f33e7bb3eb
("dmaengine: tegra210-adma: restore channel status") Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
parent
069b3c4214
commit
b53611fb1c
|
@ -845,16 +845,6 @@ static int tegra_adma_probe(struct platform_device *pdev)
|
|||
return PTR_ERR(tdma->ahub_clk);
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
ret = pm_runtime_get_sync(&pdev->dev);
|
||||
if (ret < 0)
|
||||
goto rpm_disable;
|
||||
|
||||
ret = tegra_adma_init(tdma);
|
||||
if (ret)
|
||||
goto rpm_put;
|
||||
|
||||
INIT_LIST_HEAD(&tdma->dma_dev.channels);
|
||||
for (i = 0; i < tdma->nr_channels; i++) {
|
||||
struct tegra_adma_chan *tdc = &tdma->channels[i];
|
||||
|
@ -873,6 +863,16 @@ static int tegra_adma_probe(struct platform_device *pdev)
|
|||
tdc->tdma = tdma;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
ret = pm_runtime_get_sync(&pdev->dev);
|
||||
if (ret < 0)
|
||||
goto rpm_disable;
|
||||
|
||||
ret = tegra_adma_init(tdma);
|
||||
if (ret)
|
||||
goto rpm_put;
|
||||
|
||||
dma_cap_set(DMA_SLAVE, tdma->dma_dev.cap_mask);
|
||||
dma_cap_set(DMA_PRIVATE, tdma->dma_dev.cap_mask);
|
||||
dma_cap_set(DMA_CYCLIC, tdma->dma_dev.cap_mask);
|
||||
|
@ -916,13 +916,13 @@ static int tegra_adma_probe(struct platform_device *pdev)
|
|||
|
||||
dma_remove:
|
||||
dma_async_device_unregister(&tdma->dma_dev);
|
||||
irq_dispose:
|
||||
while (--i >= 0)
|
||||
irq_dispose_mapping(tdma->channels[i].irq);
|
||||
rpm_put:
|
||||
pm_runtime_put_sync(&pdev->dev);
|
||||
rpm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
irq_dispose:
|
||||
while (--i >= 0)
|
||||
irq_dispose_mapping(tdma->channels[i].irq);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user