[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191202173752.GD133384@yoga>
Date: Mon, 2 Dec 2019 09:37:52 -0800
From: Bjorn Andersson <bjorn.andersson@...aro.org>
To: Georgi Djakov <georgi.djakov@...aro.org>
Cc: linux-pm@...r.kernel.org, agross@...nel.org, digetx@...il.com,
evgreen@...omium.org, daidavid1@...eaurora.org,
masneyb@...tation.org, sibis@...eaurora.org,
linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH v2 3/5] interconnect: qcom: msm8974: Walk the list safely
on node removal
On Mon 02 Dec 08:21 PST 2019, Georgi Djakov wrote:
> 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@...il.com>
> Signed-off-by: Georgi Djakov <georgi.djakov@...aro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@...aro.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 f29974ea9671..ca25f31e5f0b 100644
> --- a/drivers/interconnect/qcom/msm8974.c
> +++ b/drivers/interconnect/qcom/msm8974.c
> @@ -643,7 +643,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;
>
> @@ -723,7 +723,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);
> }
> @@ -739,9 +739,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);
> }
Powered by blists - more mailing lists