提交 73c93426 编写于 作者: A Andy Shevchenko 提交者: 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: NDaniel Scally <djrscally@gmail.com>
Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210329151207.36619-3-andriy.shevchenko@linux.intel.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 06ad93c3
...@@ -981,15 +981,14 @@ fwnode_create_software_node(const struct property_entry *properties, ...@@ -981,15 +981,14 @@ fwnode_create_software_node(const struct property_entry *properties,
{ {
struct fwnode_handle *fwnode; struct fwnode_handle *fwnode;
struct software_node *node; struct software_node *node;
struct swnode *p = NULL; struct swnode *p;
if (parent) { if (IS_ERR(parent))
if (IS_ERR(parent)) return ERR_CAST(parent);
return ERR_CAST(parent);
if (!is_software_node(parent)) p = to_swnode(parent);
return ERR_PTR(-EINVAL); if (parent && !p)
p = to_swnode(parent); return ERR_PTR(-EINVAL);
}
node = software_node_alloc(properties); node = software_node_alloc(properties);
if (IS_ERR(node)) if (IS_ERR(node))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册