28.11.2019 16:34, Georgi Djakov ÐÐÑÐÑ:[..]>> +static int qnoc_remove(struct platform_device *pdev)
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(-)
+{
+ 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.