[PATCH] fixup! of: port Linux of_get_compatible_child helper

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The barebox implementation of for_each_child_of_node doesn't set the
iterator to NULL, when the list of children is empty.

Fix of_get_compatible_child to deal with this.

Suggested-by: Sascha Hauer <sha@xxxxxxxxxxxxxx>
Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 drivers/of/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5a0374a82c5c..1223e0ab558f 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -1730,10 +1730,10 @@ struct device_node *of_get_compatible_child(const struct device_node *parent,
 
 	for_each_child_of_node(parent, child) {
 		if (of_device_is_compatible(child, compatible))
-			break;
+			return child;
 	}
 
-	return child;
+	return NULL;
 }
 EXPORT_SYMBOL(of_get_compatible_child);
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux