summaryrefslogtreecommitdiffstats
path: root/drivers/base/swnode.c
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2019-08-30 09:51:55 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-09-04 23:03:19 +0200
commit616368735e4aa6e3d25cd3474b746014ee490a7b (patch)
tree84935b2c525746c3a8f72e31ef4c43e2773ed111 /drivers/base/swnode.c
parentACPI / property: Fix acpi_graph_get_remote_endpoint() name in kerneldoc (diff)
downloadlinux-616368735e4aa6e3d25cd3474b746014ee490a7b.tar.xz
linux-616368735e4aa6e3d25cd3474b746014ee490a7b.zip
software node: Initialize the return value in software_node_to_swnode()
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 even if the list is empty. Fixes: 80488a6b1d3c ("software node: Add support for static node descriptors") 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/swnode.c')
-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 ee2a405cca9a..1838d72e618a 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(is_software_node);
static struct swnode *
software_node_to_swnode(const struct software_node *node)
{
- struct swnode *swnode;
+ struct swnode *swnode = NULL;
struct kobject *k;
if (!node)