Re: [PATCH v10 2/3] interconnect: qcom: Add MSM8916 interconnect provider driver

From: Georgi Djakov
Date: Wed Nov 13 2019 - 08:24:27 EST


Hi Dmitry,

On 13.11.19 Ð. 15:03 Ñ., Dmitry Osipenko wrote:
> 30.10.2019 18:39, Georgi Djakov ÐÐÑÐÑ:
>> Add driver for the Qualcomm interconnect buses found in MSM8916 based
>> platforms. The topology consists of three NoCs that are controlled by
>> a remote processor that collects the aggregated bandwidth for each
>> master-slave pairs.
>>
[..]
>> +static int qnoc_remove(struct platform_device *pdev)
>> +{
>> + struct qcom_icc_provider *qp = platform_get_drvdata(pdev);
>> + struct icc_provider *provider = &qp->provider;
>> + struct icc_node *n;
>> +
>> + list_for_each_entry(n, &provider->nodes, node_list) {
>> + icc_node_del(n);
>> + icc_node_destroy(n->id);
>> + }
>
> Hello Georgi,
>
> While examining the interconnect API and current drivers' code, I
> noticed that everybody are copying this chunk of code which should crash
> kernel because removing node from a list during the traverse is allowed
> only when list_for_each_entry_safe() is used.

Nice catch. Thank you!

> Seems the IMX driver (which is under review now on the ML) is the only
> driver that does the removing procedure correctly.
>
> Maybe it won't hurt to factor out the removal of provider's nodes into a
> common helper.
>

Yes, this is a very good idea. Will do it.

Thanks,
Georgi