[POWERPC] Make sure device node type/name is not NULL on hot-added nodes

Our device-tree unflattening code makes sure the name and type fields
of a device-node are not NULL. However, the code for dynamically
adding devices nodes which is used for pSeries hotplug for example
didn't do it, potentially causing crashes in some code that assume it
can always do things like strcmp on those.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
This commit is contained in:
Benjamin Herrenschmidt 2007-05-16 16:57:24 +10:00 committed by Paul Mackerras
parent c72ea777d4
commit 847f5976f9
1 changed files with 5 additions and 0 deletions

View File

@ -1472,6 +1472,11 @@ static int of_finish_dynamic_node(struct device_node *node)
node->name = of_get_property(node, "name", NULL); node->name = of_get_property(node, "name", NULL);
node->type = of_get_property(node, "device_type", NULL); node->type = of_get_property(node, "device_type", NULL);
if (!node->name)
node->name = "<NULL>";
if (!node->type)
node->type = "<NULL>";
if (!parent) { if (!parent) {
err = -ENODEV; err = -ENODEV;
goto out; goto out;