Skip to content

Commit 1662dd6

Browse files
digetxthierryreding
authored andcommitted
memory: tegra: Correct driver probe order
The Reset Controller should be registered in the end of probe, otherwise Memory Controller device goes away if IRQ requesting fails and the Reset Controller stays registered. To avoid having to unwind the MC probing in a case of SMMU probe failure, let's simply print the error message without failing the MC probe. This allows us to just move the Reset Controller registering before the SMMU registration, reducing code churning. Also let's not fail MC probe in a case of Reset Controller registration failure as it doesn't prevent the MC driver to work. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent ce397d2 commit 1662dd6

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

  • drivers/memory/tegra

‎drivers/memory/tegra/mc.c‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -672,13 +672,6 @@ static int tegra_mc_probe(struct platform_device *pdev)
672672
return err;
673673
}
674674

675-
err = tegra_mc_reset_setup(mc);
676-
if (err < 0) {
677-
dev_err(&pdev->dev, "failed to register reset controller: %d\n",
678-
err);
679-
return err;
680-
}
681-
682675
mc->irq = platform_get_irq(pdev, 0);
683676
if (mc->irq < 0) {
684677
dev_err(&pdev->dev, "interrupt not specified\n");
@@ -697,13 +690,16 @@ static int tegra_mc_probe(struct platform_device *pdev)
697690
return err;
698691
}
699692

693+
err = tegra_mc_reset_setup(mc);
694+
if (err < 0)
695+
dev_err(&pdev->dev, "failed to register reset controller: %d\n",
696+
err);
697+
700698
if (IS_ENABLED(CONFIG_TEGRA_IOMMU_SMMU)) {
701699
mc->smmu = tegra_smmu_probe(&pdev->dev, mc->soc->smmu, mc);
702-
if (IS_ERR(mc->smmu)) {
700+
if (IS_ERR(mc->smmu))
703701
dev_err(&pdev->dev, "failed to probe SMMU: %ld\n",
704702
PTR_ERR(mc->smmu));
705-
return PTR_ERR(mc->smmu);
706-
}
707703
}
708704

709705
return 0;

0 commit comments

Comments
 (0)