9
0
Fork 0

OF: base: bail out early on missing matches for of_match_node

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@gmail.com>
This commit is contained in:
Sebastian Hesselbarth 2013-06-13 17:35:22 +02:00 committed by Sascha Hauer
parent 196be5c776
commit ee63abaa06
1 changed files with 3 additions and 0 deletions

View File

@ -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;