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 0B479C636D3 for ; Wed, 1 Feb 2023 10:25:21 +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=tAB/zAWETQXdTdqC1FYgPD8gCP71GhLwNEf1KzWsLXM=; b=KSU83iA8ymzgJT LsYSA2HLnXjAE4lWH2gpP2IYjddg2fAGDPm3wRZ5JopV53lFbV81xSNd6qEWi2aLRDdpyYJEBuoQq yFtihOQ8bhLkThzMb9/HVl0dcok1k7mW8Kk7fRy2keVoXAmL5JjctM7M9zFcmTWU8HGhE1EnFGNZz qYfzRIMF6tJzkFWuOl59tCOc9v608H5/M/R0QrVd1aEmdajSCYSdFPBTzfpp5pA4WEb5ZI5ytQLNf c22msSueux/OZ3Y7jabJD26YZfBwJAgN89KQdVs+LF6300z0kDmPxwbVPHSXu3ECav1RIH3dgyXt9 SWD6upq7x5COpOqchSVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNAHd-00BD10-Vu; Wed, 01 Feb 2023 10:24:06 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNAAb-00B9SY-0M for linux-arm-kernel@bombadil.infradead.org; Wed, 01 Feb 2023 10:16:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=ehbJaTLVP2OnTvXPS0O5QZyzJ11CeBYoO0TYv85Jnw4=; b=GamLg3hJqknOwbCrOi7FLb7lFY fNj6Xtzi+iZXAzryHOIMfHTZZwqacN9MQu6XCx1t/1OdMszTKbAALTkUPc/Sudw9J65YsvRCCJ2+5 HXy0wGlUHA2tCocIHqpTwmKFz7XqykCNSGy5n7+NjtcBeTVX/I0eCc3iYpCrUAybr6jN8TZZaq6tW QXER9B2lcTSiW2lWkx7wJq9+MIQj3X2NSuTlFCRwtOZOGq+SaoHL8jt/3hhh02bLScP97XksIpNu9 iXfO4rf0NamAjg2TO14EWla+N1Bw3j6CPTeywYtnYhKtWse/KnN5y583gffMMBz9AZaWN+lW0VZVJ IH8a9Ljw==; Received: from ams.source.kernel.org ([145.40.68.75]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pNA9y-004j1R-0s for linux-arm-kernel@lists.infradead.org; Wed, 01 Feb 2023 10:16:12 +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 ams.source.kernel.org (Postfix) with ESMTPS id 4574CB82171; Wed, 1 Feb 2023 10:16:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67496C43172; Wed, 1 Feb 2023 10:16:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675246593; bh=+fgTystr/1l8K9USBL4FI5JoE6y0/BWQM1jZupEsZnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MNlSai5dz7svAwRgqsQF3kqN7Q8uKDmsgjsimiHlzrLNtHyki5OQezR3pWsbFffeF IoqQAHUEGQHSAaylDp6npA0DFxwTXmEiAvytzzqF566qGo0smyYbFhdLlDzd6qsPS+ BPr5IrHeaSBNdDx8x1Rkr363e6o03e0brtoLdJB442ay+AKhefp+6t60VhAIpWEVzs gwZbNMyzyFi1GXWYn1rlOTiKlp7JVmlaKIPKGOhvo1iR/aFika5Sov61KDmD+OCWFn F/9V+zPRWCzwkS+ItjhuX4Cw03sQyStALhq8MDxBjo2gaBvWwXJFSwJwDdcPy/9Wvd pmkJTPje9FIOw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pNAAg-00044T-J1; Wed, 01 Feb 2023 11:16:54 +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 , stable@vger.kernel.org, Dmitry Osipenko Subject: [PATCH 18/23] memory: tegra124-emc: fix interconnect registration race Date: Wed, 1 Feb 2023 11:15:54 +0100 Message-Id: <20230201101559.15529-19-johan+linaro@kernel.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230201101559.15529-1-johan+linaro@kernel.org> References: <20230201101559.15529-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-20230201_101610_726958_1559C592 X-CRM114-Status: GOOD ( 15.00 ) 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: 380def2d4cf2 ("memory: tegra124: Support interconnect framework") Cc: stable@vger.kernel.org # 5.12 Cc: Dmitry Osipenko Signed-off-by: Johan Hovold --- drivers/memory/tegra/tegra124-emc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/memory/tegra/tegra124-emc.c b/drivers/memory/tegra/tegra124-emc.c index 85bc936c02f9..00ed2b6a0d1b 100644 --- a/drivers/memory/tegra/tegra124-emc.c +++ b/drivers/memory/tegra/tegra124-emc.c @@ -1351,15 +1351,13 @@ static int tegra_emc_interconnect_init(struct tegra_emc *emc) emc->provider.aggregate = soc->icc_ops->aggregate; emc->provider.xlate_extended = emc_of_icc_xlate_extended; - err = icc_provider_add(&emc->provider); - if (err) - goto err_msg; + icc_provider_init(&emc->provider); /* create External Memory Controller node */ node = icc_node_create(TEGRA_ICC_EMC); if (IS_ERR(node)) { err = PTR_ERR(node); - goto del_provider; + goto err_msg; } node->name = "External Memory Controller"; @@ -1380,12 +1378,14 @@ static int tegra_emc_interconnect_init(struct tegra_emc *emc) node->name = "External Memory (DRAM)"; icc_node_add(node, &emc->provider); + err = icc_provider_register(&emc->provider); + if (err) + goto remove_nodes; + return 0; remove_nodes: icc_nodes_remove(&emc->provider); -del_provider: - icc_provider_del(&emc->provider); err_msg: dev_err(emc->dev, "failed to initialize ICC: %d\n", err); -- 2.39.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel