Re: [PATCH 5/5] interconnect: qcom: Use the new common helper for node removal

From: Georgi Djakov
Date: Thu Nov 28 2019 - 08:52:08 EST


On 28.11.19 Ð. 15:43 Ñ., Dmitry Osipenko wrote:
28.11.2019 16:34, Georgi Djakov ÐÐÑÐÑ:
There is a new helper function for removing all nodes. Let's use it instead
of duplicating the code.

In addition to the above, instead of duplicating the code, simplify the
probe function error path by calling driver removal function directly.

Signed-off-by: Georgi Djakov <georgi.djakov@xxxxxxxxxx>
---
drivers/interconnect/qcom/msm8974.c | 40 ++++++++++-------------------
drivers/interconnect/qcom/qcs404.c | 31 ++++++++--------------
drivers/interconnect/qcom/sdm845.c | 29 +++++++--------------
3 files changed, 33 insertions(+), 67 deletions(-)

[..]>> +static int qnoc_remove(struct platform_device *pdev)
+{
+ struct qcom_icc_provider *qp = platform_get_drvdata(pdev);
+
+ icc_nodes_remove(&qp->provider);
+ return icc_provider_del(&qp->provider);
+}
+
static int qnoc_probe(struct platform_device *pdev)
{
const struct qcom_icc_desc *desc;
@@ -855,29 +863,10 @@ static int qnoc_probe(struct platform_device *pdev)
return ret;
err:
- list_for_each_entry(node, &provider->nodes, node_list) {
- icc_node_del(node);
- icc_node_destroy(node->id);
- }
-
- icc_provider_del(provider);
+ qnoc_remove(pdev);

This is wrong because platform_set_drvdata() is invoked at the end of
qnoc_probe(), thus platform_get_drvdata() of qnoc_remove() returns NULL
here.

True! Will fix it! Thank you!

BR,
Georgi