From patchwork Mon Dec 2 16:21:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 180619 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp182901ile; Mon, 2 Dec 2019 08:21:42 -0800 (PST) X-Google-Smtp-Source: APXvYqz0UcoKf3te5dwCGvr85Z4si0vf7qf3leAP6AHFBKdUcNjg/K79rC/FPRPZqwgCPil9HOw/ X-Received: by 2002:a5d:4983:: with SMTP id r3mr54752801wrq.134.1575303702320; Mon, 02 Dec 2019 08:21:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575303702; cv=none; d=google.com; s=arc-20160816; b=fSYeEuN9VRMA+foyBFt6/r+DwRFuD28FSvXpwwI4VL1lvvGl/uExLJrg2B9Zoj639w RfIQTNqoWCseCYa+VDijbPzLENqHnzAj+B7fd+qjTtd6RK811cBn9t/xdUJyzSP5Bxy1 P1Fh3GDXQWQ0c6jNivMPLPQ3PdexioosWDFqmZ32+AsX1ny2VVsECBmYDsyxYhEAUo2i PzBIdpnZeEVp/L2dY0JvbrxaSS7Yfmpbf5+/qKxnzJqFL2kLTsGDgyROVcMgRSE6h5YK 6dsXABhiIQEi6oFl8MccwZ9FrjaPCtEtLibYY6/1bLxL3FsqSrXxtChJi5TStuN9/hLa ebog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=i3hce8rncscuvP/l1ZHZTtieB5MS4JyYpc/T2PE+Kxk=; b=Gib1z44DXt774yg8qxs3jJtfXr6599NqL3oHJfoyHL0e5EPyjgAdZemYXhKid2HTQx uu6ISU0VqshhWW+EwPf5jPTJ/uRkvOTx5kR1DMPsX0h3NX4y3q9iFHPVSYwW3HjXYsGa jc7KXifaXsgZil9GKmHPO3GmLcz/NqzjTtgfnATGfboXGBaCHhv6kmRetKzXlt481QSi HuV+gCJrWbQ1jVzLO2WRy2U0LmtDa5JpS2ElgKYBbFp0lNu2GWaj0N31cnT+39sYPyJX v78jDLdAx/K7jJB8S9yALUt+b9CQJMdjCRPULfNzVrlbzVQOBT7W/HmJew4M4q/UMeeZ dptw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BE1Rz6vN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dd11si14535749ejb.177.2019.12.02.08.21.41; Mon, 02 Dec 2019 08:21:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BE1Rz6vN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727648AbfLBQVj (ORCPT + 27 others); Mon, 2 Dec 2019 11:21:39 -0500 Received: from mail-wr1-f66.google.com ([209.85.221.66]:36590 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727418AbfLBQVi (ORCPT ); Mon, 2 Dec 2019 11:21:38 -0500 Received: by mail-wr1-f66.google.com with SMTP id z3so45034282wru.3 for ; Mon, 02 Dec 2019 08:21:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=i3hce8rncscuvP/l1ZHZTtieB5MS4JyYpc/T2PE+Kxk=; b=BE1Rz6vNXRg7sd9D4JsqoBEe+a6i+xNVBv+xt5suxCeM/F5EH1GxIAP5zZ8GnNiX8e SDyYr7SH0N/I5WLB8b3Z0n7DI7l62lJN3psAJGsLawlizXLVRQjLEYAVuI/uA/eGwosu 4Y+oO0D1Ymr8GhkMET7OvboWgv9L7A+MWQEgSKOTv9OLFNNBX1DlgunxhAowoP1gbAhO OIQ9RJ+oaW67J5IzFVih/bd/+X8h2yJx/5lQFKxzOC4OVLi8NomZj03ZFGq9ob8p82Rt D8aa46nTbH5GZszd7+KPwWdSSS3jgclFK55df+IYNRP3jzdd8HAz7vfUGHRh7Ag/2wb0 wFXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=i3hce8rncscuvP/l1ZHZTtieB5MS4JyYpc/T2PE+Kxk=; b=Vd1jz/M6xqy60LBQqDRQZspklEXvMp6RWm4ujODoHDVH5Ifjqa9af+c7KW74ydeX/e 7H/kat/Jn1+5P4p8v3DUaUlmqAVPtVIDfb0uty6cDUAbzxrbgfdLHWNRJr+J7iZYgut4 4QpK5IDbxTF5JZwD3w3mgoK4hlXchEcgeOMlPVhr9GAY0vPz+p5pyX7Hhuaw8DiPmHqy pQOy20LKF2T8KZ42ZAgxJG7XUkBZW9+qKvgfWzb+CDdpiB/y68I37Y1bUEPbCjwQTl4P Ohad7on8/zQHExoWAtO4d61b4dm5hEWoXcqKnIQOTxOUu9iy/7y2M7t0xr/XYeuQXQX7 6rdw== X-Gm-Message-State: APjAAAW87qRjw+YA0RNSJqBnvqxKhjlsp0ODXhtF14Yli5cMQTNFN4qH TBYI/UGAbSjPGgpw2z1V9fQXBQ== X-Received: by 2002:adf:b19a:: with SMTP id q26mr25103318wra.79.1575303696450; Mon, 02 Dec 2019 08:21:36 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:35 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: bjorn.andersson@linaro.org, agross@kernel.org, digetx@gmail.com, evgreen@chromium.org, daidavid1@codeaurora.org, masneyb@onstation.org, sibis@codeaurora.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v2 1/5] interconnect: qcom: sdm845: Walk the list safely on node removal Date: Mon, 2 Dec 2019 18:21:29 +0200 Message-Id: <20191202162133.7089-1-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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: b5d2f741077a ("interconnect: qcom: Add sdm845 interconnect provider driver") Reported-by: Dmitry Osipenko Signed-off-by: Georgi Djakov --- v2: - Fix the number of parameters that got messed up. (Bjorn) drivers/interconnect/qcom/sdm845.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/interconnect/qcom/sdm845.c b/drivers/interconnect/qcom/sdm845.c index 502a6c22b41e..387267ee9648 100644 --- a/drivers/interconnect/qcom/sdm845.c +++ b/drivers/interconnect/qcom/sdm845.c @@ -868,9 +868,9 @@ 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; + 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); } From patchwork Mon Dec 2 16:21:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 180623 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp183223ile; Mon, 2 Dec 2019 08:21:55 -0800 (PST) X-Google-Smtp-Source: APXvYqyoe2+Bx+HT0/GWUN+bJGnCQwf8XTFo6G0dWqEkbB9D+3vHJDjx6fSYaepb1mrL8ndOkxiK X-Received: by 2002:a05:600c:30a:: with SMTP id q10mr29048702wmd.84.1575303714708; Mon, 02 Dec 2019 08:21:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575303714; cv=none; d=google.com; s=arc-20160816; b=SFZnmLaTncydbxM31NL1YSgYNMQsEgpDAN2nESPU/h0HSMu32LMnv9M6Am4Pn2oxNK eCVX0OF9jEIplF4tJFWRlBSUKwQCKGMS5eYqQqrZnJ33iiIYZ1VG/sPZon/VEwkbXbBh UzHHD4nJGIyWonKHoroh3wxUXxNUpEpUk8PPFmECkLenTsCZb+Ai3RlxXuZDqF86I1E4 t8w9/hpy4LlV+y4T6gIwo6xzGgewyKY9jIWa6g80tKq0mUbwcwod1xujvadDolkGgYn2 DBtQNs20RVecYuxRYYuCh2fke+u2eRwPjastTNAlzi1/8BzGR6m/hUQjAa2keXQlzvRP 4S6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RcVG/qj8yyYNSIPEYKFW4bW3tWMavwQ5W53FJik00WM=; b=EE7tJEwvwdhPvka1QHL9YAqkobwoRhJFEdQtE+ywVBVuVVpHgFGUKSS+YqXX7k51sj Q+2QFj5NXtbzi4nrvRkTn5MQk4pikArH/L7JbJ9QHw7DDfC7jBSn/8hOpshUjbosSjlg sz/Aa/ewV8W3fdMn6z7UeR1930RfN2TaLGS3LagQha7z+5Fr2PIXBPoUcXIZHzcsvaMW zBkAnxcN+gERnANxqx6u/dL5j0/O/xpm8r8VZ+uwg576bv/0mEzZcKSpwpzxWeB8p8Cv UptPqXh47fvwUJKS141f3+nMfYtBqApF8I4sNvs971UpcmTvjxoIjDvp1zdbRuwSF1vL lgcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AP6DiGL/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bs15si22314518edb.408.2019.12.02.08.21.54; Mon, 02 Dec 2019 08:21:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AP6DiGL/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727673AbfLBQVm (ORCPT + 27 others); Mon, 2 Dec 2019 11:21:42 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41715 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727634AbfLBQVj (ORCPT ); Mon, 2 Dec 2019 11:21:39 -0500 Received: by mail-wr1-f68.google.com with SMTP id b18so45062175wrj.8 for ; Mon, 02 Dec 2019 08:21:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RcVG/qj8yyYNSIPEYKFW4bW3tWMavwQ5W53FJik00WM=; b=AP6DiGL/aQDTxsAfZ1x0QW+Tv8Bg7T5RqQnXQmNd2D7OmhJ/YbRW1pmAjuDOkM2Y2F 0xGdykT8B6nyEKr9akZYeTPLwCSAridNAkPznb19AHx3u9eVgUQpuDRnw5U2avBiQfG/ PnsAwETCY+nidrFK0fkulfX1bd87h+6Gsw8LOAoJjGAarWiauj0mDJq/n7ub4OV/lUPh /Ud4d9x5Siix/pN7AZQHNsAWTmwUmH0JHHp3tnAEOtg4ZeeLd+OpAB3eKgZLLRWtGIh9 KiCfqvewrsnuUXm/K+lkeJe6tEL/9+PU77gfs6Nxmtsi0y97vQHDhZPYnH4kMNgKSYiL 48KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RcVG/qj8yyYNSIPEYKFW4bW3tWMavwQ5W53FJik00WM=; b=QZkkhcpW92T+OLHBPQXzm8Cr3tA/NEZQhJnCw9J/EPQvKXKdQWAcCrRdzOEunRv7n9 8BUAjLkITkvOAAmqRHys0+gi4IGG7vRXYYmA/k4YWa8e1m/WDzVoeBYMwZNVoTkLV3e3 J8d30tssEPNp7bruSFDe/5olCWLPegnAPNXZgGxLn1QoMencaX7HCGyOQFVwb12R9GOc rw66uDl21ICGQNWc9seF/EAEDZ1k0tA3MOkPtzbV/1104D5jAmTTq3890pBOaFTIuhFx lZoxtOn6TLNrr3ivKZksRBRXVeDQ9Qlu1o9LyqwR3smjY1l2DH8snvOJnRN/CUMuKzRS 7Glg== X-Gm-Message-State: APjAAAV9r8YJKDVK31FgSeYcq582G6Z+W+dvqnAthf3ngsupmtFCCFYM vvEM5uRDg/kzquiAqu7xD1Iu8js1xgs= X-Received: by 2002:adf:a746:: with SMTP id e6mr15118778wrd.329.1575303697776; Mon, 02 Dec 2019 08:21:37 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:37 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: bjorn.andersson@linaro.org, agross@kernel.org, digetx@gmail.com, evgreen@chromium.org, daidavid1@codeaurora.org, masneyb@onstation.org, sibis@codeaurora.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v2 2/5] interconnect: qcom: qcs404: Walk the list safely on node removal Date: Mon, 2 Dec 2019 18:21:30 +0200 Message-Id: <20191202162133.7089-2-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191202162133.7089-1-georgi.djakov@linaro.org> References: <20191202162133.7089-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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: 5e4e6c4d3ae0 ("interconnect: qcom: Add QCS404 interconnect provider driver") Reported-by: Dmitry Osipenko Signed-off-by: Georgi Djakov --- drivers/interconnect/qcom/qcs404.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c index 5e5843e6bd06..9064f6bdaa69 100644 --- a/drivers/interconnect/qcom/qcs404.c +++ b/drivers/interconnect/qcom/qcs404.c @@ -405,7 +405,7 @@ static int qnoc_probe(struct platform_device *pdev) struct icc_provider *provider; struct qcom_icc_node **qnodes; struct qcom_icc_provider *qp; - struct icc_node *node; + struct icc_node *node, *tmp; size_t num_nodes, i; int ret; @@ -485,7 +485,7 @@ static int qnoc_probe(struct platform_device *pdev) return 0; err: - 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); } @@ -499,9 +499,9 @@ 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; + 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); } From patchwork Mon Dec 2 16:21:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 180620 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp183041ile; Mon, 2 Dec 2019 08:21:48 -0800 (PST) X-Google-Smtp-Source: APXvYqw0hQO0hHYIXnZ0HcBwNjKHQcEwU6ynnHcca2j/PNc8jc49jSmhCShicJtz3aDqHqyEWjvy X-Received: by 2002:a17:906:6b89:: with SMTP id l9mr39158900ejr.130.1575303708628; Mon, 02 Dec 2019 08:21:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575303708; cv=none; d=google.com; s=arc-20160816; b=LPivEb1tbYgqExbWivRX7/EPX6ZFfODfSY/whqm3sYrx0NsRy3VuqSpbsiZCvIKBb7 PaDYz6fO4YjSLDTfImWBpIBWgLUCz//iDN9VBb37E1sXk8qTlHqDEPpJoFc9QBhY0arF sA2OHHi/1SQA+OQqf2SqkYs+1AO7aNfzyoRFfdopd9eX1kWXsfWM7Db9/5OHsnYsmsdS 683frD4XNCxZoqs3+6chThhyYwiyCXUxmhmnNm67Nn8sN1LBs1uJegaBnf+TDg1HoyGH 1+w77r4jv797w5+dKkntgxHxyW1e0p7dRmHahkYQgEduLwWJj1qjx+18wRdY9Gb/dPar ARAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oMBJAp4LSOF18EKZsarCjIvV97iU3KlOms/xsyIv3iQ=; b=tWmqxOh6jRl/xzR/oimr65XoMUgnpQvILnI0HjSu9iW9ysA2Kty8isReCdzMEGACAR jNLFyNILQArQPiwt7yAX9MFAjzYWTqaOwBd+rKPgsPmxEhJie2OeLUpUauN5ulpU0SDQ Qwm08K7mRvyfC1s9w/HmffK1LABzRySfZGkTD3IoStrzOXzMtZbHCfQ7LiUUeVztF1Xh u03ILOWKkskvDPHbHiZm+niARBx9CFx6vURnT7Lq/XcijQEVz32E53GsrWMgUGvRxG9M fpSjbzQz69Ev6eVKVl304EoeBH1diSm4nYMWmrCtxcn7+G6s4MwyytCT+/oZpGUKz3Wv Uq5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bIM2E4qQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r7si2727998ejx.16.2019.12.02.08.21.48; Mon, 02 Dec 2019 08:21:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bIM2E4qQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727685AbfLBQVo (ORCPT + 27 others); Mon, 2 Dec 2019 11:21:44 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:40935 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727650AbfLBQVl (ORCPT ); Mon, 2 Dec 2019 11:21:41 -0500 Received: by mail-wr1-f65.google.com with SMTP id c14so20448278wrn.7 for ; Mon, 02 Dec 2019 08:21:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oMBJAp4LSOF18EKZsarCjIvV97iU3KlOms/xsyIv3iQ=; b=bIM2E4qQ6P+LyYmjxXTsCE4nf2gqeqyCpaqijLgjBd5rSLfDIbh7mwl3XW1bBKIca+ 5R4fnwcgNEiKGlQH7I2Gf+t3VDeCoW/eVANZOH5MtgbkCaU8YMQPy8TXK/gsviJ3PPpA K64lZKCfBUpvGCWnpeq0d3CnYV1mDd7D8qD37vhIwuY5LgxWRTtR60smA6p5EFYhRrZb 9mUmPaUs37tYNSOMScuGD7eojrFiwusAvQDYFvbkuS72kXfk5qgVd7kdH/3RVzsoU17L Q19VvRjKxnuiwFpBuiIwN8moJtDbTil9Z7YpRp71rpqTGuVLWgxdxQLnM5burmTv7dYy 20Kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oMBJAp4LSOF18EKZsarCjIvV97iU3KlOms/xsyIv3iQ=; b=uLh92DsCh//TJW5alsjyCd7eoC/ME9sPeLKuD24Dyz/4apfRZ1EtgaAPxUbEWDX3vB 5xQ52iAeA3GPS72wB7sZrd9TtnlB9MQEK0jBQG59HdUK4dH54ro5cs1XSWg2Tq/C+NW6 XY6TH65byyF+A2LaIa0tKfq3R1vijEY0djOf+hqD9P2VBdCivMbIomjLaT2NwaPG4HR0 yw3p/2Q+48gXT+0lLIkaOOPFApSXwa6KIclljJ5jSM23j6s9XdEu6tbBL3VZV572TG2a fHuzkZOA7UX0U2sHRHPm4rZ6vczBsh1DYmZYrK/Sa1QF8ecSD8LNSvcO2uTK8GJD1vos DqtA== X-Gm-Message-State: APjAAAXT1vL8MZPiauNN4r8UJMjrux2RrY3iAKW+twqP8Fd8wjSOyA4x 0ajy075fgDl1VU4qjTvZm4l+pA== X-Received: by 2002:a5d:4983:: with SMTP id r3mr54752462wrq.134.1575303699158; Mon, 02 Dec 2019 08:21:39 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:38 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: bjorn.andersson@linaro.org, agross@kernel.org, digetx@gmail.com, evgreen@chromium.org, daidavid1@codeaurora.org, masneyb@onstation.org, sibis@codeaurora.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v2 3/5] interconnect: qcom: msm8974: Walk the list safely on node removal Date: Mon, 2 Dec 2019 18:21:31 +0200 Message-Id: <20191202162133.7089-3-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191202162133.7089-1-georgi.djakov@linaro.org> References: <20191202162133.7089-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 Signed-off-by: Georgi Djakov --- 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); } From patchwork Mon Dec 2 16:21:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georgi Djakov X-Patchwork-Id: 180621 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp183097ile; Mon, 2 Dec 2019 08:21:51 -0800 (PST) X-Google-Smtp-Source: APXvYqxSdSTvFb7AVw+mdtgMFiKQit/XvJpSrJdeR53csPcJBYq4YuOavl51g/EtLnzhYlzOPfyh X-Received: by 2002:adf:8041:: with SMTP id 59mr5411894wrk.257.1575303710852; Mon, 02 Dec 2019 08:21:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575303710; cv=none; d=google.com; s=arc-20160816; b=TPg99DVHn8rIotGC9el+Uo731VGb+Sz1/azvXuFDO0xGFo0S8SW15kzyepnYbbSbLb E86hPuQuolTdABNPxFBlCP04p4qr6vT2k73FDlQYQb6clBXPECDmZyYwFTzG6frt7I5n zy4VXFaWHbUI8QSgM+/Ic8nCEIJIi1PyUZi73pwu5u5DTS0ZxOIkO+ZOr554xtkz+McG LA3NK5ot1jAp7EXztXt6BiiY71cIIULcfBKm/Yk5LZRGGPV+l4ifPu12sZR/uOm1dhQy DHlAIRB4AoENuBHTzvGofiv5gWfhhZmSS0YEuPwHoZChB3EQ8+J4QYYDO1+t9AdKTHjn aJOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GH8jZgvcmqwZW7+ZZ9HpIyzBO+HHjblMrgUlhjTkr1o=; b=ceEdADNXv1co1kozWrJAmBTi1faJbNw/Kz7t2v5aSADoaCZPI8yyAtwopMPpaaaRdA dGlSH+2zwH0uYqtAW+nkiem9U9Vbepg2boFG3RxP2XKIn5s6ILREkpiLUl9wTfzFzMPE uguLeADtJ10dBWF1Ppckk5Zm1OXKDXZUTPS2BoYNKo3kcMm+CA8bRP8gP1+eWcJWsQmK yOVQwTZapqZnX8KFV9NvkbWf+LGrF1/esCj5tKdp2V51FgrpIebquvSgFbdifI2yQE/h YsRQk+AmLHaOQS6EVlssxQT+5MXTW+boQvDgkZZ2I9m4NPlJK+nfxckWt0yjnzfHPUYo 6vfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wwtDicZu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t18si20736645ejx.354.2019.12.02.08.21.50; Mon, 02 Dec 2019 08:21:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wwtDicZu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbfLBQVs (ORCPT + 27 others); Mon, 2 Dec 2019 11:21:48 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37691 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727669AbfLBQVo (ORCPT ); Mon, 2 Dec 2019 11:21:44 -0500 Received: by mail-wr1-f67.google.com with SMTP id w15so14102916wru.4 for ; Mon, 02 Dec 2019 08:21:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GH8jZgvcmqwZW7+ZZ9HpIyzBO+HHjblMrgUlhjTkr1o=; b=wwtDicZu/7SddGtkXbL33maSZtHCYO1JIf/RboO5KNIbTfhdubKaXiB0DDzKrNXSFd mvW7wprl/QvhrWIV6DVSHClsxvjmXgXb5C3Fdiom2wnOk+/ZqtUyKgua2NP3D7dgZwPl W4aEAsm+q7hDiDs3N+PdYefY9Yb1gL92Tiq2cJq7I8qz/k1fcHJTM4eY56UHAgpD+E5u 9IM7JZegB0O6G+9j4AdIaykPuWdwa3oDEcv45hGOEq4foDjRFHRkxVfEz3St9EO7bl1m 5S+QFGCE96gNpq2PMDEiHRgiVmCzFnpXQNj/Mn0rfk6KsiNM7xWjEIht+gBKGoR2XUXE 8nkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GH8jZgvcmqwZW7+ZZ9HpIyzBO+HHjblMrgUlhjTkr1o=; b=sXLlbprGbZ1o9e2jcVFdTtYdgWvAbit+DkcAnkhz1p+G4hkNvg6nx8w7NSDWHpbfXQ XdtkhyFvLSwndk09yKb/oG1QQLkrRRVbFYALFS/M4YauCn97RcaBBz8yBx48/rHxyBn3 9T4KKMFsxM09b59Rn5LXeVFLCyBZN5OtUuGBktNbcmoLnzwLpK14OY3DRdKF7CxW9goM dECXJbVrrzsJKBBk/3wdHUQ8x2JV3PZAnbTitzzLNpcYqAhnS/7rza7v9mNQdNP/vAS2 wk4onHWC7JwPLFJt0bavOqpXK/QaRJiVpvDi47NZfkZG6B96et1bHNFX7xdXkqwVygKD E0kg== X-Gm-Message-State: APjAAAXkSUJKSdW2y2DvJibWz9kCtanIlGt+dF5rWobg5uP/YleigJ2S 9WPmgf6bkrmCEsfvfd22S3KB+A== X-Received: by 2002:adf:b19a:: with SMTP id q26mr25103882wra.79.1575303701678; Mon, 02 Dec 2019 08:21:41 -0800 (PST) Received: from localhost.localdomain ([212.45.67.2]) by smtp.googlemail.com with ESMTPSA id i9sm39204516wrb.2.2019.12.02.08.21.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Dec 2019 08:21:41 -0800 (PST) From: Georgi Djakov To: linux-pm@vger.kernel.org Cc: bjorn.andersson@linaro.org, agross@kernel.org, digetx@gmail.com, evgreen@chromium.org, daidavid1@codeaurora.org, masneyb@onstation.org, sibis@codeaurora.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, georgi.djakov@linaro.org Subject: [PATCH v2 5/5] interconnect: qcom: Use the new common helper for node removal Date: Mon, 2 Dec 2019 18:21:33 +0200 Message-Id: <20191202162133.7089-5-georgi.djakov@linaro.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191202162133.7089-1-georgi.djakov@linaro.org> References: <20191202162133.7089-1-georgi.djakov@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is a new helper function for removing all nodes. Let's use it instead of duplicating the code. Signed-off-by: Georgi Djakov --- v2: - Don't call qnoc_remove() directly from probe. (Dmitry) drivers/interconnect/qcom/msm8974.c | 17 ++++------------- drivers/interconnect/qcom/qcs404.c | 17 ++++------------- drivers/interconnect/qcom/sdm845.c | 16 +++------------- 3 files changed, 11 insertions(+), 39 deletions(-) Reviewed-by: Bjorn Andersson diff --git a/drivers/interconnect/qcom/msm8974.c b/drivers/interconnect/qcom/msm8974.c index ca25f31e5f0b..3a313e11e73d 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, *tmp; + struct icc_node *node; size_t num_nodes, i; int ret; @@ -723,10 +723,7 @@ static int msm8974_icc_probe(struct platform_device *pdev) return 0; err_del_icc: - list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) { - icc_node_del(node); - icc_node_destroy(node->id); - } + icc_nodes_remove(provider); icc_provider_del(provider); err_disable_clks: @@ -738,16 +735,10 @@ static int msm8974_icc_probe(struct platform_device *pdev) 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, *tmp; - list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { - icc_node_del(n); - icc_node_destroy(n->id); - } + icc_nodes_remove(&qp->provider); clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); - - return icc_provider_del(provider); + return icc_provider_del(&qp->provider); } static const struct of_device_id msm8974_noc_of_match[] = { diff --git a/drivers/interconnect/qcom/qcs404.c b/drivers/interconnect/qcom/qcs404.c index 9064f6bdaa69..d4769a5ea182 100644 --- a/drivers/interconnect/qcom/qcs404.c +++ b/drivers/interconnect/qcom/qcs404.c @@ -405,7 +405,7 @@ static int qnoc_probe(struct platform_device *pdev) struct icc_provider *provider; struct qcom_icc_node **qnodes; struct qcom_icc_provider *qp; - struct icc_node *node, *tmp; + struct icc_node *node; size_t num_nodes, i; int ret; @@ -485,10 +485,7 @@ static int qnoc_probe(struct platform_device *pdev) return 0; err: - list_for_each_entry_safe(node, tmp, &provider->nodes, node_list) { - icc_node_del(node); - icc_node_destroy(node->id); - } + icc_nodes_remove(provider); clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); icc_provider_del(provider); @@ -498,16 +495,10 @@ static int qnoc_probe(struct platform_device *pdev) 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, *tmp; - list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { - icc_node_del(n); - icc_node_destroy(n->id); - } + icc_nodes_remove(&qp->provider); clk_bulk_disable_unprepare(qp->num_clks, qp->bus_clks); - - return icc_provider_del(provider); + return icc_provider_del(&qp->provider); } static const struct of_device_id qcs404_noc_of_match[] = { diff --git a/drivers/interconnect/qcom/sdm845.c b/drivers/interconnect/qcom/sdm845.c index 387267ee9648..f078cf0fce56 100644 --- a/drivers/interconnect/qcom/sdm845.c +++ b/drivers/interconnect/qcom/sdm845.c @@ -855,11 +855,7 @@ static int qnoc_probe(struct platform_device *pdev) return ret; err: - list_for_each_entry(node, &provider->nodes, node_list) { - icc_node_del(node); - icc_node_destroy(node->id); - } - + icc_nodes_remove(provider); icc_provider_del(provider); return ret; } @@ -867,15 +863,9 @@ static int qnoc_probe(struct platform_device *pdev) 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, *tmp; - - list_for_each_entry_safe(n, tmp, &provider->nodes, node_list) { - icc_node_del(n); - icc_node_destroy(n->id); - } - return icc_provider_del(provider); + icc_nodes_remove(&qp->provider); + return icc_provider_del(&qp->provider); } static const struct of_device_id qnoc_of_match[] = {