aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/base.c
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2008-05-07 15:19:59 -0400
committerPaul Mackerras <paulus@samba.org>2008-05-15 06:49:49 -0400
commit64e4566f6d590fbb284da061b9b664c2486dd2de (patch)
treef47b0659fa97f798fa05708e4ea9ecc3e6d136cc /drivers/of/base.c
parentcec08e7a948326b01555be6311480aa08e637de2 (diff)
[POWERPC] Add null pointer check to of_find_property
Update function of_find_property() to return NULL if the device_node passed to it is also NULL. Otherwise, passing NULL will cause a null pointer dereference. Without this, the legacy_serial driver will crash if there's no 'chosen' node in the device tree. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/of/base.c')
-rw-r--r--drivers/of/base.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/of/base.c b/drivers/of/base.c
index 9bd7c4a31253..23ffb7c0caf2 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -65,6 +65,9 @@ struct property *of_find_property(const struct device_node *np,
65{ 65{
66 struct property *pp; 66 struct property *pp;
67 67
68 if (!np)
69 return NULL;
70
68 read_lock(&devtree_lock); 71 read_lock(&devtree_lock);
69 for (pp = np->properties; pp != 0; pp = pp->next) { 72 for (pp = np->properties; pp != 0; pp = pp->next) {
70 if (of_prop_cmp(pp->name, name) == 0) { 73 if (of_prop_cmp(pp->name, name) == 0) {