summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2019-08-30 10:51:56 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-09-11 19:10:12 +0200
commit016049a816774edc9c3cd81afa7724d7ab001585 (patch)
treea3de6b294e81063138c80328544bc60a03f7cccb /drivers/base
parent616368735e4aa6e3d25cd3474b746014ee490a7b (diff)
downloadlinux-016049a816774edc9c3cd81afa7724d7ab001585.tar.gz
linux-016049a816774edc9c3cd81afa7724d7ab001585.tar.bz2
linux-016049a816774edc9c3cd81afa7724d7ab001585.zip
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: 1666faedb567 ("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>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/swnode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index 1838d72e618a..a1f3f0994f9f 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -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)