linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc/tegra: pmc: fix child-node lookup
@ 2017-11-15  9:44 Johan Hovold
  2017-11-16 11:40 ` Mikko Perttunen
  2018-03-22 14:24 ` Thierry Reding
  0 siblings, 2 replies; 7+ messages in thread
From: Johan Hovold @ 2017-11-15  9:44 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Jonathan Hunter, linux-tegra, linux-kernel, Johan Hovold, stable,
	Mikko Perttunen

Fix child-node lookup during probe, which ended up searching the whole
device tree depth-first starting at the parent rather than just matching
on its children.

To make things worse, the parent pmc node could end up being prematurely
freed as of_find_node_by_name() drops a reference to its first argument.

Fixes: 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")
Cc: stable <stable@vger.kernel.org>     # 4.0
Cc: Mikko Perttunen <mperttunen@nvidia.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/soc/tegra/pmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 0453ff6839a7..7e9ef3431bea 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -1321,7 +1321,7 @@ static void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc)
 	if (!pmc->soc->has_tsense_reset)
 		return;
 
-	np = of_find_node_by_name(pmc->dev->of_node, "i2c-thermtrip");
+	np = of_get_child_by_name(pmc->dev->of_node, "i2c-thermtrip");
 	if (!np) {
 		dev_warn(dev, "i2c-thermtrip node not found, %s.\n", disabled);
 		return;
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-14 14:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-15  9:44 [PATCH] soc/tegra: pmc: fix child-node lookup Johan Hovold
2017-11-16 11:40 ` Mikko Perttunen
2018-01-12  9:19   ` Johan Hovold
2018-03-22 13:52     ` Johan Hovold
2018-03-22 14:24 ` Thierry Reding
2018-08-13 14:33   ` Johan Hovold
2018-08-14 14:24     ` Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).