[PATCH][next] ACPI: scan: ensure ret is initialized to avoid garbage being returned

From: Colin King
Date: Wed Jun 09 2021 - 13:33:17 EST


From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

In the unlikely event that there are no callback calls made then ret
will be returned as an uninitialized value. Clean up static analysis
warnings by ensuring ret is initialized.

Addresses-Coverity: ("Uninitialized scalar variable")
Fixes: a9e10e587304 ("ACPI: scan: Extend acpi_walk_dep_device_list()")
Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
---
drivers/acpi/scan.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index c3067e8bfc47..0945d952f0fc 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2151,7 +2151,7 @@ int acpi_walk_dep_device_list(acpi_handle handle,
void *data)
{
struct acpi_dep_data *dep, *tmp;
- int ret;
+ int ret = 0;

mutex_lock(&acpi_dep_list_lock);
list_for_each_entry_safe(dep, tmp, &acpi_dep_list, node) {
--
2.31.1