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

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.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 06ad93c3
......@@ -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;
if (parent) {
if (IS_ERR(parent))
return ERR_CAST(parent);
if (!is_software_node(parent))
return ERR_PTR(-EINVAL);
p = to_swnode(parent);
}
struct swnode *p;
if (IS_ERR(parent))
return ERR_CAST(parent);
p = to_swnode(parent);
if (parent && !p)
return ERR_PTR(-EINVAL);
node = software_node_alloc(properties);
if (IS_ERR(node))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment