Software node can not be registered before its parent.
Fixes: 80488a6b1d3c ("software node: Add support for static node descriptors") Cc: stable@vger.kernel.org Signed-off-by: Heikki Krogerus heikki.krogerus@linux.intel.com --- drivers/base/swnode.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 37179a8b1ceba..74db8c971db74 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -938,6 +938,9 @@ int software_node_register(const struct software_node *node) 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);