--- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -812,6 +812,9 @@ int software_node_register(const struct if (software_node_to_swnode(node)) return -EEXIST; + if (node->parent && !parent) + return -EINVAL; + return PTR_ERR_OR_ZERO(swnode_register(node, parent, 0)); } EXPORT_SYMBOL_GPL(software_node_register);