Skip to content

Commit abd9f1b

Browse files
jhovoldGeorgi Djakov
authored andcommitted
memory: tegra124-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: 380def2 ("memory: tegra124: Support interconnect framework") Cc: [email protected] # 5.12 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 5553055 commit abd9f1b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/memory/tegra/tegra124-emc.c

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

1354-
err = icc_provider_add(&emc->provider);
1355-
if (err)
1356-
goto err_msg;
1354+
icc_provider_init(&emc->provider);
13571355

13581356
/* create External Memory Controller node */
13591357
node = icc_node_create(TEGRA_ICC_EMC);
13601358
if (IS_ERR(node)) {
13611359
err = PTR_ERR(node);
1362-
goto del_provider;
1360+
goto err_msg;
13631361
}
13641362

13651363
node->name = "External Memory Controller";
@@ -1380,12 +1378,14 @@ static int tegra_emc_interconnect_init(struct tegra_emc *emc)
13801378
node->name = "External Memory (DRAM)";
13811379
icc_node_add(node, &emc->provider);
13821380

1381+
err = icc_provider_register(&emc->provider);
1382+
if (err)
1383+
goto remove_nodes;
1384+
13831385
return 0;
13841386

13851387
remove_nodes:
13861388
icc_nodes_remove(&emc->provider);
1387-
del_provider:
1388-
icc_provider_del(&emc->provider);
13891389
err_msg:
13901390
dev_err(emc->dev, "failed to initialize ICC: %d\n", err);
13911391

0 commit comments

Comments
 (0)