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);
On Mon, Mar 01, 2021 at 05:30:11PM +0300, Heikki Krogerus wrote:
Software node can not be registered before its parent.
Reviewed-by: Andy Shevchenko andriy.shevchenko@linux.intel.com Tested-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
(On Intel Galileo Gen 2 with some custom patches to convert gpio-dwapb et al. to use swnodes. Those patches a subject to further submission.)
Thanks!
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); -- 2.30.1
linux-stable-mirror@lists.linaro.org