From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8DA2FC678D4 for ; Mon, 6 Mar 2023 08:03:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WCqA9c+lFHzu0yx0f6/ESjdy5cVWMMUejLSaQ8vvKc8=; b=CRBssC/8wYonRC C60+QIhMJhDFrHY4zSqWO+DplL4IpYmjB9U5mI9sEAI/LfYhCErPIVIwnxZg0W6lYBC0GP9k2c7aJ FuGTsyS8SFkjAJv6Ym5GAfyb/mkF6HJzO8YoGrw9ofrj00B7bY/nBxJaiv9f+WM+Y2upodPbXiuvS JOz43KImKgjK4GCkeLa2pzXaJlzZG801lMxE14JVs2FMI7v2h+onbeKOMHoyXSguvv64KFIRlm5JL sMuP6FUnXixju8peCtYRVty9ou4bO6rZ2ozM7EwNc9PwDyGv7FzKH9n9IZ2Rqt5okqkI5Cr74JD0u OjEK0A9tJSPQ7vaX07Kg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZ5nF-00Bjdx-O8; Mon, 06 Mar 2023 08:02:02 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZ5j4-00BhcC-Ft for linux-arm-kernel@lists.infradead.org; Mon, 06 Mar 2023 07:57:45 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 754A760CE8; Mon, 6 Mar 2023 07:57:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B591FC4323F; Mon, 6 Mar 2023 07:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678089456; bh=mqS1yMpvOtlF/aD510co9QvL9Sqs3EAV2IRE+AQZLQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O7yOFZl+Qtk4XX74Qi70u1qDBllxYcmqeiI8UbdGX/vLfpnc2YGSwLlOQ4QmSeOPC Tb15OUaEV2anm2bH7SAGS06tuDwgbGYhumVP0kK7IOakvOe5K7GVTZ1yfAqLAlHxL2 t3jaF9GbMO2PBH36LDoKf1IayBwCpzCOdtTwOkpkWt+rPgLy52/x759bt7tm1bEAUB s5wcTL85UyLu540cxY/6KjDNAA8H9wAB/LPFOD7hGs0fd6gBgc1s4Sbxip8ai4ubcy IoQpYECiI+6sXQfEckSEIPPAM1lteKE+dx2Kt3aJ/5QryCYk/aBX7yMNbk8fZiR0Hv b3ERCPRfY1rgQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pZ5jc-0000iQ-T3; Mon, 06 Mar 2023 08:58:16 +0100 From: Johan Hovold To: Georgi Djakov Cc: "Shawn Guo" , "Sascha Hauer" , "Pengutronix Kernel Team" , "Fabio Estevam" , "NXP Linux Team" , "Andy Gross" , "Bjorn Andersson" , "Konrad Dybcio" , "Sylwester Nawrocki" , =?UTF-8?q?Artur=20=C5=9Awigo=C5=84?= , "Krzysztof Kozlowski" , "Alim Akhtar" , "Thierry Reding" , "Jonathan Hunter" , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold , Abel Vesa Subject: [PATCH v2 13/23] interconnect: qcom: sm8550: fix registration race Date: Mon, 6 Mar 2023 08:56:41 +0100 Message-Id: <20230306075651.2449-14-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230306075651.2449-1-johan+linaro@kernel.org> References: <20230306075651.2449-1-johan+linaro@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230305_235742_820387_02466D37 X-CRM114-Status: GOOD ( 17.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The current interconnect provider registration interface is inherently racy as nodes are not added until the after adding the provider. This can specifically cause racing DT lookups to fail. Switch to using the new API where the provider is not registered until after it has been fully initialised. Fixes: e6f0d6a30f73 ("interconnect: qcom: Add SM8550 interconnect provider driver") Reviewed-by: Abel Vesa Reviewed-by: Konrad Dybcio Signed-off-by: Johan Hovold --- drivers/interconnect/qcom/sm8550.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/interconnect/qcom/sm8550.c b/drivers/interconnect/qcom/sm8550.c index 54fa027ab961..7ab492ca8fe0 100644 --- a/drivers/interconnect/qcom/sm8550.c +++ b/drivers/interconnect/qcom/sm8550.c @@ -2197,9 +2197,10 @@ static int qnoc_probe(struct platform_device *pdev) provider->pre_aggregate = qcom_icc_pre_aggregate; provider->aggregate = qcom_icc_aggregate; provider->xlate_extended = qcom_icc_xlate_extended; - INIT_LIST_HEAD(&provider->nodes); provider->data = data; + icc_provider_init(provider); + qp->dev = &pdev->dev; qp->bcms = desc->bcms; qp->num_bcms = desc->num_bcms; @@ -2208,12 +2209,6 @@ static int qnoc_probe(struct platform_device *pdev) if (IS_ERR(qp->voter)) return PTR_ERR(qp->voter); - ret = icc_provider_add(provider); - if (ret) { - dev_err_probe(&pdev->dev, ret, - "error adding interconnect provider\n"); - return ret; - } for (i = 0; i < qp->num_bcms; i++) qcom_icc_bcm_init(qp->bcms[i], &pdev->dev); @@ -2227,7 +2222,7 @@ static int qnoc_probe(struct platform_device *pdev) node = icc_node_create(qnodes[i]->id); if (IS_ERR(node)) { ret = PTR_ERR(node); - goto err; + goto err_remove_nodes; } node->name = qnodes[i]->name; @@ -2241,12 +2236,17 @@ static int qnoc_probe(struct platform_device *pdev) } data->num_nodes = num_nodes; + ret = icc_provider_register(provider); + if (ret) + goto err_remove_nodes; + platform_set_drvdata(pdev, qp); return 0; -err: + +err_remove_nodes: icc_nodes_remove(provider); - icc_provider_del(provider); + return ret; } @@ -2254,8 +2254,8 @@ static int qnoc_remove(struct platform_device *pdev) { struct qcom_icc_provider *qp = platform_get_drvdata(pdev); + icc_provider_deregister(&qp->provider); icc_nodes_remove(&qp->provider); - icc_provider_del(&qp->provider); return 0; } -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel