Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3
+3
drivers/of/base.c
··· 496 496 const struct of_device_id *of_match_node(const struct of_device_id *matches, 497 497 const struct device_node *node) 498 498 { 499 + if (!matches) 500 + return NULL; 501 + 499 502 while (matches->name[0] || matches->type[0] || matches->compatible[0]) { 500 503 int match = 1; 501 504 if (matches->name[0])