soc/tegra: pmc: fix child-node lookup
Subsystems (2)
PATCH 1/1 soc/tegra: pmc: fix child-node lookup
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.
--- drivers/soc/tegra/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/tegra/pmc.c +1 -1
@@ -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 ;
Signature · 1 line
2.15.0
Quoted 21 lines · Johan Hovold
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 <[email protected]> # 4.0Cc Mikko Perttunen <[email protected]>Signed-off-by Johan Hovold <[email protected]>--- drivers/soc/tegra/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/soc/tegra/pmc.c +0
-0
drivers/soc/tegra/pmc.c static void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc) · line 1327
Quoted 8 lines
drivers/soc/tegra/pmc.c +1
-1@@ -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 ;
Good find!
Quoted 33 lines · Mikko Perttunen
Quoted 21 lines · Johan Hovold
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 <[email protected]> # 4.0Cc Mikko Perttunen <[email protected]>Signed-off-by Johan Hovold <[email protected]>--- drivers/soc/tegra/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/soc/tegra/pmc.c +0
-0drivers/soc/tegra/pmc.c static void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc) · line 1327
Quoted 8 lines
drivers/soc/tegra/pmc.c +1
-1@@ -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 ;Good find!
Quoted 1 line
Reviewed-by Mikko Perttunen <[email protected]>
This one still hasn't made it to linux-next so figured I'd send a reminder. Will you be picking this one up for 4.16, Thierry?
Thanks,
Johan
Quoted 34 lines · Johan Hovold
Quoted 33 lines · Mikko Perttunen
Quoted 21 lines · Johan Hovold
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 <[email protected]> # 4.0Cc Mikko Perttunen <[email protected]>Signed-off-by Johan Hovold <[email protected]>--- drivers/soc/tegra/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/soc/tegra/pmc.c +0
-0drivers/soc/tegra/pmc.c static void tegra_pmc_init_tsense_reset(struct tegra_pmc *pmc) · line 1327
Quoted 8 lines
drivers/soc/tegra/pmc.c +1
-1@@ -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 ;Good find!
Quoted 4 lines
Quoted 1 line
Reviewed-by Mikko Perttunen <[email protected]>This one still hasn't made it to linux-next so figured I'd send a reminder. Will you be picking this one up for 4.16, Thierry?
Another two months, another reminder; Thierry, can you pick this fix up? It's got Mikko's ack.
Mikko, can you please ping Thierry in case I'm getting stuck in his spam filter or something?
Thanks,
Johan
Thierry Reding
AppliedQuoted 7 lines · Johan Hovold
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.
Quoted 7 lines
Fixes 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")Cc stable <[email protected]> # 4.0Cc Mikko Perttunen <[email protected]>Signed-off-by Johan Hovold <[email protected]>--- drivers/soc/tegra/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
Thierry
Hi Thierry,
Quoted 16 lines · Thierry Reding
Quoted 7 lines · Johan Hovold
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.Quoted 7 lines
Fixes 3568df3d31d6 ("soc: tegra: Add thermal reset (thermtrip) support to PMC")Cc stable <[email protected]> # 4.0Cc Mikko Perttunen <[email protected]>Signed-off-by Johan Hovold <[email protected]>--- drivers/soc/tegra/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 1 line
Applied, thanks.
I noticed this one still hasn't made it into linux-next. Looks like it wasn't included in you 4.17 pull request and is still sitting in the tegra for-4.17/soc branch.
Johan
Quoted 19 lines · Johan Hovold
Hi Thierry,
Quoted 16 lines · Thierry Reding
Quoted 14 lines · Johan Hovold
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 <[email protected]> # 4.0Cc Mikko Perttunen <[email protected]>Signed-off-by Johan Hovold <[email protected]>--- drivers/soc/tegra/pmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines
Quoted 1 line
Applied, thanks.
I noticed this one still hasn't made it into linux-next. Looks like it wasn't included in you 4.17 pull request and is still sitting in the tegra for-4.17/soc branch.
Indeed. Looking at my tree it seems like I applied this to for-4.17/soc a couple of days after the signed tag for the pull request. It probably should've gone into a for-4.18/soc, or perhaps into fixes pull request.
I've cherry-picked it into for-4.20/soc now. Thanks for the reminder.
Thierry