diff options
author | Thomas Abraham <thomas.abraham@linaro.org> | 2013-01-19 10:20:42 -0800 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2013-01-20 16:26:42 -0600 |
commit | dc71bcf1b99c265fffdb1e8c60e7933612f3bca7 (patch) | |
tree | c9ff0a23acfd5b5a2dd487a13cab817e2b671a19 /drivers/of/base.c | |
parent | 7d1f9aeff1ee4a20b1aeb377dd0f579fe9647619 (diff) |
of: fix incorrect return value of of_find_matching_node_and_match()
The of_find_matching_node_and_match() function incorrectly sets the matched
entry to 'matches' when the compatible value of a node matches one of the
possible values. This results in incorrectly selecting the the first entry in
the 'matches' list as the matched entry. Fix this by noting down the result of
the call to of_match_node() and setting that as the matched entry.
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r-- | drivers/of/base.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c index 2390ddb22d6..960ae5bf3dd 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -612,6 +612,7 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from, const struct of_device_id **match) { struct device_node *np; + const struct of_device_id *m; if (match) *match = NULL; @@ -619,9 +620,10 @@ struct device_node *of_find_matching_node_and_match(struct device_node *from, read_lock(&devtree_lock); np = from ? from->allnext : of_allnodes; for (; np; np = np->allnext) { - if (of_match_node(matches, np) && of_node_get(np)) { + m = of_match_node(matches, np); + if (m && of_node_get(np)) { if (match) - *match = matches; + *match = m; break; } } |