[PATCH 02/22] OF: base: bail out early on missing matches for of_match_node

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

 



of_match_node checks for compatiblity between a set of matches and a
node. Neither the matches nor node pointer are checked for validity.
This adds the required checks to of_match_node.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@xxxxxxxxx>
---
Cc: barebox@xxxxxxxxxxxxxxxxxxx
---
 drivers/of/base.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 4241e65..ab0f4cd 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -321,6 +321,9 @@ EXPORT_SYMBOL(of_device_is_compatible);
 const struct of_device_id *of_match_node(const struct of_device_id *matches,
 					 const struct device_node *node)
 {
+	if (!matches || !node)
+		return NULL;
+
 	while (matches->compatible) {
 		if (of_device_is_compatible(node, matches->compatible) == 1)
 			return matches;
-- 
1.7.2.5


_______________________________________________
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