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:
parent
196be5c776
commit
ee63abaa06
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue