Skip to content

Commit 6163687

Browse files
Heikki Krogerusrafaeljw
authored andcommitted
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: 80488a6 ("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>
1 parent 3a2650a commit 6163687

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/base/swnode.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(is_software_node);
5151
static struct swnode *
5252
software_node_to_swnode(const struct software_node *node)
5353
{
54-
struct swnode *swnode;
54+
struct swnode *swnode = NULL;
5555
struct kobject *k;
5656

5757
if (!node)

0 commit comments

Comments
 (0)