Skip to content

Commit c5587f6

Browse files
jhovoldGeorgi Djakov
authored andcommitted
memory: tegra20-emc: 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: d5ef16b ("memory: tegra20: Support 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 abd9f1b commit c5587f6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/memory/tegra/tegra20-emc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,15 +1021,13 @@ static int tegra_emc_interconnect_init(struct tegra_emc *emc)
10211021
emc->provider.aggregate = soc->icc_ops->aggregate;
10221022
emc->provider.xlate_extended = emc_of_icc_xlate_extended;
10231023

1024-
err = icc_provider_add(&emc->provider);
1025-
if (err)
1026-
goto err_msg;
1024+
icc_provider_init(&emc->provider);
10271025

10281026
/* create External Memory Controller node */
10291027
node = icc_node_create(TEGRA_ICC_EMC);
10301028
if (IS_ERR(node)) {
10311029
err = PTR_ERR(node);
1032-
goto del_provider;
1030+
goto err_msg;
10331031
}
10341032

10351033
node->name = "External Memory Controller";
@@ -1050,12 +1048,14 @@ static int tegra_emc_interconnect_init(struct tegra_emc *emc)
10501048
node->name = "External Memory (DRAM)";
10511049
icc_node_add(node, &emc->provider);
10521050

1051+
err = icc_provider_register(&emc->provider);
1052+
if (err)
1053+
goto remove_nodes;
1054+
10531055
return 0;
10541056

10551057
remove_nodes:
10561058
icc_nodes_remove(&emc->provider);
1057-
del_provider:
1058-
icc_provider_del(&emc->provider);
10591059
err_msg:
10601060
dev_err(emc->dev, "failed to initialize ICC: %d\n", err);
10611061

0 commit comments

Comments
 (0)