From 016049a816774edc9c3cd81afa7724d7ab001585 Mon Sep 17 00:00:00 2001 From: Heikki Krogerus Date: Fri, 30 Aug 2019 10:51:56 +0300 Subject: [PATCH] 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 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 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) -- 2.20.1