Unbalanced of_node_put{get} on initial 'from' node?
Shawn Guo
shawn.guo at freescale.com
Fri Jul 15 02:39:58 EST 2011
Hi Grant,
I'm running into some problem when using of_find_matching_node().
Here is the pseudo code.
void foo(struct platform_device *pdev)
{
struct device_node *from = pdev->dev.parent->of_node;
struct device_node *np;
np = of_find_matching_node(from, matches); /* matches is a global of_match */
while (np) {
...... /* do stuff with the node */
np = of_find_matching_node(np, matches);
}
}
I found with above function executed that the node 'from'
gets an unbalanced 'of_node_put' call in of_find_matching_node(). Was
of_find_matching_node() designed in this way? Or should it get
of_node_put{get} on 'from' node balanced?
Using helper macro for_each_matching_node does not run into this
problem, because the initial 'from' node is NULL, which will get
bypassed by of_node_put.
--
Regards,
Shawn
More information about the devicetree-discuss
mailing list