Skip to content

Commit 174941e

Browse files
jhovoldGeorgi Djakov
authored andcommitted
interconnect: qcom: osm-l3: 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: of_icc_xlate_onecell: invalid index 0 cpu cpu0: error -EINVAL: error finding src node cpu cpu0: dev_pm_opp_of_find_icc_paths: Unable to get path0: -22 qcom-cpufreq-hw: probe of 18591000.cpufreq failed with error -22 Switch to using the new API where the provider is not registered until after it has been fully initialised. Fixes: 5bc9900 ("interconnect: qcom: Add OSM L3 interconnect provider support") Cc: [email protected] # 5.7 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 9fbd355 commit 174941e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/interconnect/qcom/osm-l3.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ static int qcom_osm_l3_remove(struct platform_device *pdev)
158158
{
159159
struct qcom_osm_l3_icc_provider *qp = platform_get_drvdata(pdev);
160160

161+
icc_provider_deregister(&qp->provider);
161162
icc_nodes_remove(&qp->provider);
162-
icc_provider_del(&qp->provider);
163163

164164
return 0;
165165
}
@@ -245,14 +245,9 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
245245
provider->set = qcom_osm_l3_set;
246246
provider->aggregate = icc_std_aggregate;
247247
provider->xlate = of_icc_xlate_onecell;
248-
INIT_LIST_HEAD(&provider->nodes);
249248
provider->data = data;
250249

251-
ret = icc_provider_add(provider);
252-
if (ret) {
253-
dev_err(&pdev->dev, "error adding interconnect provider\n");
254-
return ret;
255-
}
250+
icc_provider_init(provider);
256251

257252
for (i = 0; i < num_nodes; i++) {
258253
size_t j;
@@ -275,12 +270,15 @@ static int qcom_osm_l3_probe(struct platform_device *pdev)
275270
}
276271
data->num_nodes = num_nodes;
277272

273+
ret = icc_provider_register(provider);
274+
if (ret)
275+
goto err;
276+
278277
platform_set_drvdata(pdev, qp);
279278

280279
return 0;
281280
err:
282281
icc_nodes_remove(provider);
283-
icc_provider_del(provider);
284282

285283
return ret;
286284
}

0 commit comments

Comments
 (0)