software node: Initialize the return value in software_node_find_by_name()

The software node is searched from a list that may be empty
when the function is called. This makes sure that the
function returns NULL if the list is empty.

Fixes: 1666faedb5 ("software node: Add software_node_find_by_name()")
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Heikki Krogerus 2019-08-30 10:51:56 +03:00 committed by Rafael J. Wysocki
parent 616368735e
commit 016049a816

View File

@ -633,7 +633,7 @@ static const struct fwnode_operations software_node_ops = {
const struct software_node *
software_node_find_by_name(const struct software_node *parent, const char *name)
{
struct swnode *swnode;
struct swnode *swnode = NULL;
struct kobject *k;
if (!name)