aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-11-11 10:31:18 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-28 09:17:48 -0500
commit33c309ebc797b908029fd3a0851aefe697e9b598 (patch)
tree7805e2471a8d44fca4b9cc679a9bc9b2c2bed5f3
parent446f666da9f019ce2ffd03800995487e79a91462 (diff)
USB: ulpi: fix bus-node lookup
Fix bus-node lookup during registration, which ended up searching the whole device tree depth-first starting at the parent (or grand parent) rather than just matching on its children. To make things worse, the parent (or grand-parent) node could end being prematurely freed as well. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Reported-by: Peter Robinson <pbrobinson@gmail.com> Reported-by: Stephen Boyd <sboyd@codeaurora.org> Cc: stable <stable@vger.kernel.org> # 4.10 Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/common/ulpi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index 8b351444cc40..9a2ab6751a23 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -180,9 +180,9 @@ static int ulpi_of_register(struct ulpi *ulpi)
180 /* Find a ulpi bus underneath the parent or the grandparent */ 180 /* Find a ulpi bus underneath the parent or the grandparent */
181 parent = ulpi->dev.parent; 181 parent = ulpi->dev.parent;
182 if (parent->of_node) 182 if (parent->of_node)
183 np = of_find_node_by_name(parent->of_node, "ulpi"); 183 np = of_get_child_by_name(parent->of_node, "ulpi");
184 else if (parent->parent && parent->parent->of_node) 184 else if (parent->parent && parent->parent->of_node)
185 np = of_find_node_by_name(parent->parent->of_node, "ulpi"); 185 np = of_get_child_by_name(parent->parent->of_node, "ulpi");
186 if (!np) 186 if (!np)
187 return 0; 187 return 0;
188 188