Skip to content

Commit 3883539

Browse files
Saravana Kannangregkh
authored andcommitted
of: property: Fix the semantics of of_is_ancestor_of()
The of_is_ancestor_of() function was renamed from of_link_is_valid() based on review feedback. The rename meant the semantics of the function had to be inverted, but this was missed in the earlier patch. So, fix the semantics of of_is_ancestor_of() and invert the conditional expressions where it is used. Fixes: a3e1d1a ("of: property: Add functional dependency link from DT bindings") Signed-off-by: Saravana Kannan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 60774d2 commit 3883539

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/of/property.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -993,11 +993,11 @@ static bool of_is_ancestor_of(struct device_node *test_ancestor,
993993
while (child) {
994994
if (child == test_ancestor) {
995995
of_node_put(child);
996-
return false;
996+
return true;
997997
}
998998
child = of_get_next_parent(child);
999999
}
1000-
return true;
1000+
return false;
10011001
}
10021002

10031003
/**
@@ -1043,7 +1043,7 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,
10431043
* descendant nodes. By definition, a child node can't be a functional
10441044
* dependency for the parent node.
10451045
*/
1046-
if (!of_is_ancestor_of(dev->of_node, sup_np)) {
1046+
if (of_is_ancestor_of(dev->of_node, sup_np)) {
10471047
dev_dbg(dev, "Not linking to %pOFP - is descendant\n", sup_np);
10481048
of_node_put(sup_np);
10491049
return -EINVAL;

0 commit comments

Comments
 (0)