add 'find' function for the tree

That will be useful to search for a specific node name.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
diff --git a/tree.c b/tree.c
index e681f4f..7466e31 100644
--- a/tree.c
+++ b/tree.c
@@ -223,3 +223,20 @@
 
 	return tree_for_each(tree->next, cb, data);
 }
+
+struct tree *tree_find(struct tree *tree, const char *name)
+{
+	struct tree *t;
+
+	if (!tree)
+		return NULL;
+
+	if (!strcmp(tree->name, name))
+		return tree;
+
+	t = tree_find(tree->child, name);
+	if (t)
+		return t;
+
+	return tree_find(tree->next, name);
+}