提交 33c309eb 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

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: ef6a7bcf ("usb: ulpi: Support device discovery via DT")
Reported-by: NPeter Robinson <pbrobinson@gmail.com>
Reported-by: NStephen Boyd <sboyd@codeaurora.org>
Cc: stable <stable@vger.kernel.org>     # 4.10
Signed-off-by: NJohan Hovold <johan@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 446f666d
...@@ -180,9 +180,9 @@ static int ulpi_of_register(struct ulpi *ulpi) ...@@ -180,9 +180,9 @@ static int ulpi_of_register(struct ulpi *ulpi)
/* Find a ulpi bus underneath the parent or the grandparent */ /* Find a ulpi bus underneath the parent or the grandparent */
parent = ulpi->dev.parent; parent = ulpi->dev.parent;
if (parent->of_node) if (parent->of_node)
np = of_find_node_by_name(parent->of_node, "ulpi"); np = of_get_child_by_name(parent->of_node, "ulpi");
else if (parent->parent && parent->parent->of_node) else if (parent->parent && parent->parent->of_node)
np = of_find_node_by_name(parent->parent->of_node, "ulpi"); np = of_get_child_by_name(parent->parent->of_node, "ulpi");
if (!np) if (!np)
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册