Skip to content

Commit e0e7089

Browse files
jhovoldGeorgi Djakov
authored andcommitted
interconnect: fix icc_provider_del() error handling
The interconnect framework currently expects that providers are only removed when there are no users and after all nodes have been removed. There is currently nothing that guarantees this to be the case and the framework does not do any reference counting, but refusing to remove the provider is never correct as that would leave a dangling pointer to a resource that is about to be released in the global provider list (e.g. accessible through debugfs). Replace the current sanity checks with WARN_ON() so that the provider is always removed. Fixes: 11f1cec ("interconnect: Add generic on-chip interconnect API") Cc: [email protected] # 5.1: 680f866: interconnect: Make icc_provider_del() return void Reviewed-by: Konrad Dybcio <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Tested-by: Luca Ceresoli <[email protected]> # i.MX8MP MSC SM2-MB-EP1 Board Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Georgi Djakov <[email protected]>
1 parent a5904f4 commit e0e7089

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

drivers/interconnect/core.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,18 +1065,8 @@ EXPORT_SYMBOL_GPL(icc_provider_add);
10651065
void icc_provider_del(struct icc_provider *provider)
10661066
{
10671067
mutex_lock(&icc_lock);
1068-
if (provider->users) {
1069-
pr_warn("interconnect provider still has %d users\n",
1070-
provider->users);
1071-
mutex_unlock(&icc_lock);
1072-
return;
1073-
}
1074-
1075-
if (!list_empty(&provider->nodes)) {
1076-
pr_warn("interconnect provider still has nodes\n");
1077-
mutex_unlock(&icc_lock);
1078-
return;
1079-
}
1068+
WARN_ON(provider->users);
1069+
WARN_ON(!list_empty(&provider->nodes));
10801070

10811071
list_del(&provider->provider_list);
10821072
mutex_unlock(&icc_lock);

0 commit comments

Comments
 (0)