Skip to content

Commit 5553055

Browse files
jhovoldGeorgi Djakov
authored andcommitted
memory: tegra: fix interconnect registration race
The current interconnect provider registration interface is inherently racy as nodes are not added until the after adding the provider. This can specifically cause racing DT lookups to fail. Switch to using the new API where the provider is not registered until after it has been fully initialised. Fixes: 06f0798 ("memory: tegra-mc: Add interconnect framework") Cc: [email protected] # 5.11 Cc: Dmitry Osipenko <[email protected]> Acked-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Georgi Djakov <[email protected]>
1 parent 859ad5f commit 5553055

File tree

1 file changed

+7
-9
lines changed
  • drivers/memory/tegra

1 file changed

+7
-9
lines changed

drivers/memory/tegra/mc.c

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -794,16 +794,12 @@ static int tegra_mc_interconnect_setup(struct tegra_mc *mc)
794794
mc->provider.aggregate = mc->soc->icc_ops->aggregate;
795795
mc->provider.xlate_extended = mc->soc->icc_ops->xlate_extended;
796796

797-
err = icc_provider_add(&mc->provider);
798-
if (err)
799-
return err;
797+
icc_provider_init(&mc->provider);
800798

801799
/* create Memory Controller node */
802800
node = icc_node_create(TEGRA_ICC_MC);
803-
if (IS_ERR(node)) {
804-
err = PTR_ERR(node);
805-
goto del_provider;
806-
}
801+
if (IS_ERR(node))
802+
return PTR_ERR(node);
807803

808804
node->name = "Memory Controller";
809805
icc_node_add(node, &mc->provider);
@@ -830,12 +826,14 @@ static int tegra_mc_interconnect_setup(struct tegra_mc *mc)
830826
goto remove_nodes;
831827
}
832828

829+
err = icc_provider_register(&mc->provider);
830+
if (err)
831+
goto remove_nodes;
832+
833833
return 0;
834834

835835
remove_nodes:
836836
icc_nodes_remove(&mc->provider);
837-
del_provider:
838-
icc_provider_del(&mc->provider);
839837

840838
return err;
841839
}

0 commit comments

Comments
 (0)