diff options
author | Bjorn Andersson <bjorn.andersson@linaro.org> | 2021-06-25 16:49:03 -0700 |
---|---|---|
committer | Georgi Djakov <djakov@kernel.org> | 2021-07-22 10:06:51 +0300 |
commit | 9cc969675dea496b6689f576ddd4d8fd172705c5 (patch) | |
tree | 481c6571896cc90eb43809bec18ad667d12937da /drivers/interconnect/core.c | |
parent | 789a39ad39bc7ff24fe16f80326a6e38f047f10b (diff) | |
download | linux-stable-9cc969675dea496b6689f576ddd4d8fd172705c5.tar.gz linux-stable-9cc969675dea496b6689f576ddd4d8fd172705c5.tar.bz2 linux-stable-9cc969675dea496b6689f576ddd4d8fd172705c5.zip |
interconnect: Sanity check that node isn't already on list
Broken interconnect providers might add the same node multiple times or
in multiple providers, which causes strange errors as the provider's
node list is later traversed.
Detect that a node already has an associated provider, complain and
reject the addition of the node, to aid the developer.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210625234903.1324755-1-bjorn.andersson@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
Diffstat (limited to 'drivers/interconnect/core.c')
-rw-r--r-- | drivers/interconnect/core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c index 8a1e70e00876..fcb5d8eefb51 100644 --- a/drivers/interconnect/core.c +++ b/drivers/interconnect/core.c @@ -959,6 +959,9 @@ EXPORT_SYMBOL_GPL(icc_link_destroy); */ void icc_node_add(struct icc_node *node, struct icc_provider *provider) { + if (WARN_ON(node->provider)) + return; + mutex_lock(&icc_lock); node->provider = provider; |