summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2021-03-01 17:30:11 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-03-10 17:19:58 +0300
commit8891123f9cbb9c1ee531e5a87fa116f0af685c48 (patch)
tree943ca2f104745e6c4044c41ef15383af7a216435 /drivers/base
parenta38fd8748464831584a19438cbb3082b5a2dab15 (diff)
downloadlinux-8891123f9cbb9c1ee531e5a87fa116f0af685c48.tar.xz
software node: Fix node registration
Software node can not be registered before its parent. Fixes: 80488a6b1d3c ("software node: Add support for static node descriptors") Cc: 5.10+ <stable@vger.kernel.org> # 5.10+ Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/swnode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index 37179a8b1ceb..74db8c971db7 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);