From: Georgi Djakov <georgi.djakov@linaro.org>
To: gregkh@linuxfoundation.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Georgi Djakov <georgi.djakov@linaro.org>,
Dmitry Osipenko <digetx@gmail.com>,
Bjorn Andersson <bjorn.andersson@linaro.org>
Subject: [PATCH 4/4] interconnect: qcom: msm8974: Walk the list safely on node removal
Date: Thu, 12 Dec 2019 09:53:32 +0200 [thread overview]
Message-ID: <20191212075332.16202-5-georgi.djakov@linaro.org> (raw)
In-Reply-To: <20191212075332.16202-1-georgi.djakov@linaro.org>
As we will remove items off the list using list_del(), we need to use the
safe version of list_for_each_entry().
Fixes: 4e60a9568dc6 ("interconnect: qcom: add msm8974 driver")
Reported-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Georgi Djakov <georgi.djakov@linaro.org>
---
drivers/interconnect/qcom/msm8974.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/interconnect/qcom/msm8974.c b/drivers/interconnect/qcom/msm8974.c
index ce599a0c83d9..bf8bd1aee358 100644
--- a/drivers/interconnect/qcom/msm8974.c
+++ b/drivers/interconnect/qcom/msm8974.c
@@ -652,7 +652,7 @@ static int msm8974_icc_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct icc_onecell_data *data;
struct icc_provider *provider;
- struct icc_node *node;
+ struct icc_node *node, *tmp;
size_t num_nodes, i;
int ret;
@@ -732,7 +732,7 @@ static int msm8974_icc_probe(struct platform_device *pdev)
return 0;
err_del_icc:
- list_for_each_entry(node, &provider->nodes, node_list) {
+ list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) {
icc_node_del(node);
icc_node_destroy(node->id);
}
@@ -748,9 +748,9 @@ static int msm8974_icc_remove(struct platform_device *pdev)
{
struct msm8974_icc_provider *qp = platform_get_drvdata(pdev);
struct icc_provider *provider = &qp->provider;
- struct icc_node *n;
+ struct icc_node *n, *tmp;
- list_for_each_entry(n, &provider->nodes, node_list) {
+ list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) {
icc_node_del(n);
icc_node_destroy(n->id);
}
prev parent reply other threads:[~2019-12-12 7:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 7:53 [PATCH 0/4] interconnect fixes for 5.5 Georgi Djakov
2019-12-12 7:53 ` [PATCH 1/4] interconnect: qcom: Fix Kconfig indentation Georgi Djakov
2019-12-12 7:53 ` [PATCH 2/4] interconnect: qcom: sdm845: Walk the list safely on node removal Georgi Djakov
2019-12-12 7:53 ` [PATCH 3/4] interconnect: qcom: qcs404: " Georgi Djakov
2019-12-12 7:53 ` Georgi Djakov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191212075332.16202-5-georgi.djakov@linaro.org \
--to=georgi.djakov@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=digetx@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).