提交 64e4566f 编写于 作者: T Timur Tabi 提交者: Paul Mackerras

[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: NTimur Tabi <timur@freescale.com>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 cec08e7a
......@@ -65,6 +65,9 @@ struct property *of_find_property(const struct device_node *np,
{
struct property *pp;
if (!np)
return NULL;
read_lock(&devtree_lock);
for (pp = np->properties; pp != 0; pp = pp->next) {
if (of_prop_cmp(pp->name, name) == 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册