From 616368735e4aa6e3d25cd3474b746014ee490a7b Mon Sep 17 00:00:00 2001 From: Heikki Krogerus Date: Fri, 30 Aug 2019 10:51:55 +0300 Subject: [PATCH] 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 Reported-by: Dan Carpenter Signed-off-by: Heikki Krogerus Reviewed-by: Greg Kroah-Hartman Signed-off-by: Rafael J. Wysocki --- drivers/base/swnode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)