diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-03-18 10:21:29 -0600 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-03-23 14:55:55 -0600 |
commit | a52f07ecd143baee51623b063be5007585748a4f (patch) | |
tree | 2d5b66d1074b412e21026af10dd16fb2a681ff62 /drivers/of | |
parent | 38e9e21dac33082f0440d24aefb3466bb18bfed6 (diff) | |
download | linux-3.10-a52f07ecd143baee51623b063be5007585748a4f.tar.gz linux-3.10-a52f07ecd143baee51623b063be5007585748a4f.tar.bz2 linux-3.10-a52f07ecd143baee51623b063be5007585748a4f.zip |
dt: protect against NULL matches passed to of_match_node()
There are a few use cases where it is convenient to pass NULL to
of_match_node() and have it fail gracefully. The patch adds a null
check to the beginning so taht it does so.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/of')
-rw-r--r-- | 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 710b53bfac6..632ebae7f17 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -496,6 +496,9 @@ EXPORT_SYMBOL(of_find_node_with_property); const struct of_device_id *of_match_node(const struct of_device_id *matches, const struct device_node *node) { + if (!matches) + return NULL; + while (matches->name[0] || matches->type[0] || matches->compatible[0]) { int match = 1; if (matches->name[0]) |