From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9607A1C03 for ; Mon, 20 Mar 2023 15:22:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C1BBC433EF; Mon, 20 Mar 2023 15:22:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1679325767; bh=Zt0F8K9xw+LBfNYnsGFYvo4d4YcwJ3XHMOiNvxl5bh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nDxOilumgwKufReo6JuYFBJw14OhrLNSUpyiall33ZAgpHjcc3ZhAaqga7a9BPXht q3JLRGtjHk2vjncNcYquvup/pzeBXPBJiCPCe9gzoszxDP5NYzAPR1BgRitizDcWJA OhL5s3J7iIp+2QVs8McTld8iPxJdZUjPC/HdsYcU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dmitry Osipenko , Krzysztof Kozlowski , Johan Hovold , Georgi Djakov Subject: [PATCH 6.1 126/198] memory: tegra30-emc: fix interconnect registration race Date: Mon, 20 Mar 2023 15:54:24 +0100 Message-Id: <20230320145512.818410553@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230320145507.420176832@linuxfoundation.org> References: <20230320145507.420176832@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Johan Hovold commit 9db481c909dd6312ccfbdc7e343b50e41c727483 upstream. 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: d5ef16ba5fbe ("memory: tegra20: Support interconnect framework") Cc: stable@vger.kernel.org # 5.11 Cc: Dmitry Osipenko Acked-by: Krzysztof Kozlowski Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20230306075651.2449-21-johan+linaro@kernel.org Signed-off-by: Georgi Djakov Signed-off-by: Greg Kroah-Hartman --- drivers/memory/tegra/tegra30-emc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/memory/tegra/tegra30-emc.c +++ b/drivers/memory/tegra/tegra30-emc.c @@ -1546,15 +1546,13 @@ static int tegra_emc_interconnect_init(s 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"; @@ -1575,12 +1573,14 @@ static int tegra_emc_interconnect_init(s 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);