Commit 73c93426 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman
Browse files

software node: Deduplicate code in fwnode_create_software_node()



Deduplicate conditional and assignment in fwnode_create_software_node(),
i.e. parent is checked in two out of three cases and parent software node
is assigned by to_swnode() call.

Reviewed-by: default avatarDaniel Scally <djrscally@gmail.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210329151207.36619-3-andriy.shevchenko@linux.intel.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 06ad93c3
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -981,15 +981,14 @@ fwnode_create_software_node(const struct property_entry *properties,
{
	struct fwnode_handle *fwnode;
	struct software_node *node;
	struct swnode *p = NULL;
	struct swnode *p;

	if (parent) {
	if (IS_ERR(parent))
		return ERR_CAST(parent);
		if (!is_software_node(parent))
			return ERR_PTR(-EINVAL);

	p = to_swnode(parent);
	}
	if (parent && !p)
		return ERR_PTR(-EINVAL);

	node = software_node_alloc(properties);
	if (IS_ERR(node))