From: Heikki Krogerus Date: Fri, 30 Aug 2019 07:51:56 +0000 (+0300) Subject: software node: Initialize the return value in software_node_find_by_name() X-Git-Tag: v5.4-rc1~140^2 X-Git-Url: https://repo.jachan.dev/J-linux.git/commitdiff_plain/016049a816774edc9c3cd81afa7724d7ab001585 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 --- 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)