Skip to content

Commit bfe7bcd

Browse files
jhovoldGeorgi Djakov
authored andcommitted
interconnect: qcom: msm8974: fix 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: 4e60a95 ("interconnect: qcom: add msm8974 driver") Cc: [email protected] # 5.5 Reviewed-by: Brian Masney <[email protected]> Reviewed-by: Konrad Dybcio <[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 74240a5 commit bfe7bcd

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

drivers/interconnect/qcom/msm8974.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -692,27 +692,22 @@ static int msm8974_icc_probe(struct platform_device *pdev)
692692
return ret;
693693

694694
provider = &qp->provider;
695-
INIT_LIST_HEAD(&provider->nodes);
696695
provider->dev = dev;
697696
provider->set = msm8974_icc_set;
698697
provider->aggregate = icc_std_aggregate;
699698
provider->xlate = of_icc_xlate_onecell;
700699
provider->data = data;
701700
provider->get_bw = msm8974_get_bw;
702701

703-
ret = icc_provider_add(provider);
704-
if (ret) {
705-
dev_err(dev, "error adding interconnect provider: %d\n", ret);
706-
goto err_disable_clks;
707-
}
702+
icc_provider_init(provider);
708703

709704
for (i = 0; i < num_nodes; i++) {
710705
size_t j;
711706

712707
node = icc_node_create(qnodes[i]->id);
713708
if (IS_ERR(node)) {
714709
ret = PTR_ERR(node);
715-
goto err_del_icc;
710+
goto err_remove_nodes;
716711
}
717712

718713
node->name = qnodes[i]->name;
@@ -729,15 +724,16 @@ static int msm8974_icc_probe(struct platform_device *pdev)
729724
}
730725
data->num_nodes = num_nodes;
731726

727+
ret = icc_provider_register(provider);
728+
if (ret)
729+
goto err_remove_nodes;
730+
732731
platform_set_drvdata(pdev, qp);
733732

734733
return 0;
735734

736-
err_del_icc:
735+
err_remove_nodes:
737736
icc_nodes_remove(provider);
738-
icc_provider_del(provider);
739-
740-
err_disable_clks:
741737
clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks);
742738

743739
return ret;
@@ -747,9 +743,9 @@ static int msm8974_icc_remove(struct platform_device *pdev)
747743
{
748744
struct msm8974_icc_provider *qp = platform_get_drvdata(pdev);
749745

746+
icc_provider_deregister(&qp->provider);
750747
icc_nodes_remove(&qp->provider);
751748
clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks);
752-
icc_provider_del(&qp->provider);
753749

754750
return 0;
755751
}

0 commit comments

Comments
 (0)