interconnect: fix error handling in qnoc_probe()

Add missing clk_disable_unprepare() and clk_bulk_disable_unprepare()
in the error path in qnoc_probe(). And when qcom_icc_qos_set() fails,
it needs remove nodes and disable clks.

Fixes: 2e2113c8a6 ("interconnect: qcom: rpm: Handle interface clocks")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230803130521.959487-1-yangyingliang@huawei.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
This commit is contained in:
Yang Yingliang 2023-08-03 21:05:21 +08:00 committed by Georgi Djakov
parent 577a3c5af1
commit 273f74a2e7

View File

@ -497,7 +497,7 @@ regmap_done:
ret = devm_clk_bulk_get(dev, qp->num_intf_clks, qp->intf_clks); ret = devm_clk_bulk_get(dev, qp->num_intf_clks, qp->intf_clks);
if (ret) if (ret)
return ret; goto err_disable_unprepare_clk;
provider = &qp->provider; provider = &qp->provider;
provider->dev = dev; provider->dev = dev;
@ -512,13 +512,15 @@ regmap_done:
/* If this fails, bus accesses will crash the platform! */ /* If this fails, bus accesses will crash the platform! */
ret = clk_bulk_prepare_enable(qp->num_intf_clks, qp->intf_clks); ret = clk_bulk_prepare_enable(qp->num_intf_clks, qp->intf_clks);
if (ret) if (ret)
return ret; goto err_disable_unprepare_clk;
for (i = 0; i < num_nodes; i++) { for (i = 0; i < num_nodes; i++) {
size_t j; size_t j;
node = icc_node_create(qnodes[i]->id); node = icc_node_create(qnodes[i]->id);
if (IS_ERR(node)) { if (IS_ERR(node)) {
clk_bulk_disable_unprepare(qp->num_intf_clks,
qp->intf_clks);
ret = PTR_ERR(node); ret = PTR_ERR(node);
goto err_remove_nodes; goto err_remove_nodes;
} }
@ -534,8 +536,11 @@ regmap_done:
if (qnodes[i]->qos.ap_owned && if (qnodes[i]->qos.ap_owned &&
qnodes[i]->qos.qos_mode != NOC_QOS_MODE_INVALID) { qnodes[i]->qos.qos_mode != NOC_QOS_MODE_INVALID) {
ret = qcom_icc_qos_set(node); ret = qcom_icc_qos_set(node);
if (ret) if (ret) {
return ret; clk_bulk_disable_unprepare(qp->num_intf_clks,
qp->intf_clks);
goto err_remove_nodes;
}
} }
data->nodes[i] = node; data->nodes[i] = node;
@ -563,6 +568,7 @@ err_deregister_provider:
icc_provider_deregister(provider); icc_provider_deregister(provider);
err_remove_nodes: err_remove_nodes:
icc_nodes_remove(provider); icc_nodes_remove(provider);
err_disable_unprepare_clk:
clk_disable_unprepare(qp->bus_clk); clk_disable_unprepare(qp->bus_clk);
return ret; return ret;