diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c index 6906a0a7cf473fc47b292e55637e5a3a80f7e1f0..082e0b07e5c3fffc405eb5af8b00cee578fcc647 100644 --- a/drivers/base/swnode.c +++ b/drivers/base/swnode.c @@ -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))